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

[ButtonBase] Test keyboard events of child elements #18318

Merged
merged 2 commits into from
Nov 11, 2019

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Nov 11, 2019

This is a test extracted from #18271

We currently don't expect event.stopPropagation but manually check if the event is explicitly dispatched on the button i.e. are we currently focusing the button?

I think this makes for this example specifically more sense. I guess keyboard events are fundamentally different than pointer events in this regard. With cursor events we can't possibly expect that the user knows exactly what elements they want to target (since the DOM is hidden). For keyboard events we can since focused elements are perceivable.

We do receive the keyboard events but do not
trigger the pointer events
@eps1lon eps1lon added test component: ButtonBase The React component. labels Nov 11, 2019
const button = getByRole('button');
button.focus();

fireEvent.keyDown(document.activeElement || document.body, {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bug currently. Space should trigger click on keyUp not keyDown (following <button />.

@mui-pr-bot
Copy link

No bundle size changes comparing db6ed0d...80bcb51

Generated by 🚫 dangerJS against 80bcb51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ButtonBase The React component. test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants