Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tabbable events #987

Merged
merged 4 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adding tabbable events
  • Loading branch information
schoettler committed Sep 10, 2018
commit ed033fe0929ccd6acd4fba51ea1d84486e4334fd
4 changes: 2 additions & 2 deletions src/EventCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class EventCell extends React.Component {

return (
<EventWrapper {...this.props} type="date">
<div
<button
{...props}
style={{ ...userProps.style, ...style }}
className={cn('rbc-event', className, userProps.className, {
Expand All @@ -83,7 +83,7 @@ class EventCell extends React.Component {
onDoubleClick={e => onDoubleClick && onDoubleClick(event, e)}
>
{typeof children === 'function' ? children(content) : content}
</div>
</button>
</EventWrapper>
)
}
Expand Down
8 changes: 7 additions & 1 deletion src/less/event.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
.rbc-event {
padding: @event-padding;
background-color: @event-bg;
border: 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we probably need a more aggressive button style reset if we are gonna use the button tag. e.g.

button {
  padding: 0;
  margin: 0;
  border: none;
  box-shadow: none;
  background: none;
}

border-radius: @event-border-radius;
color: @event-color;
cursor: pointer;
width: 100%;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead lets do display:block; maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

display: block doesn't seem to apply the full width, how about both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm display: block seems to ruin the +5 more behaviour when events can't fit vertically

text-align: left;

.rbc-slot-selecting & {
cursor: inherit;
Expand All @@ -15,6 +18,10 @@
&.rbc-selected {
background-color: darken(@event-bg, 10%);
}

&:focus {
border: 2px solid red;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rely on the default focus outline instead? that will also avoid the shifting of buttons as you tab and their border grows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I think only Chrome has a default focus outline.

Looking at the agent stylesheet it seems to be:
outline-color: rgb(59, 153, 252)

Copy link
Contributor Author

@schoettler schoettler Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can override that behaviour for the events, since outline doesn't really respect the border-radius:
image

With:

 &:focus {
    border: 2px solid rgb(59, 153, 252); // (or hex equivalent, saved as variable)
    outline: none;
}

And defaulting to:

.rbc-event {
  border: 2px solid @event-color;
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't see an focus outline when tabbing through buttons on FF et all? They should all have something.

The main reason i want to stick what the browser default here is it's easier for folks to reset and control themselves, as opposed to having to undo our styles and add something else. It doesn't need to be pretty, just easily changeable

Copy link
Contributor Author

@schoettler schoettler Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Or append Chrome's default to all browsers, so it remains untouched in Chrome but has a default focus for other browsers:
outline: 5px auto rgb(59, 153, 252);

tabbable-events-focus

}
}

.rbc-event-label {
Expand Down Expand Up @@ -44,4 +51,3 @@
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}