-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs] Add "reset focus" control to demo tools #20724
Conversation
Details of bundle changes.Comparing: 2231349...9bbd0bc Details of page changes
|
@eps1lon two questions:
|
That doesn't make much sense. It was there before because we didn't have an appropriate control. But the container itself doesn't hold any meaning beyond visually containing the demo. It's also counter-intuitive that tab focus moves inside a container when you want to focus the next thing. |
Let's try the outline. |
I remembered why I didn't want the focusable container. It can get accidentally focused on mousedown events on certain platforms. But we can prevent that by calling |
9241c45
to
9bbd0bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about customizing the default look of the outlined and if we do about what style it should have, for instance, it's not consistent with the Rating custom outlined look we give.
It's hard to tell what you mean by consistent if the outline isn't even consistent within the ration component. |
|
That icon is less than ideal but I'd be surprised if there's an intuitive one for "reset focus". I've personally never seen this on documentation sites but feel like it's somewhat helpful for devs or auditors. Maybe someone finds a better one. |
function handleDemoMouseDown(event) { | ||
// Otherwise clicking any non-focusable element in the demo focuses the demo container | ||
// which is surprising and not how the code would behave outside of this page | ||
event.preventDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have discovered a negative side effect. Developers will no longer be able to copy and paste from the demos. For instance, try copy and paste the output of the playground in your project (my use case for making a new demo with #20755)
https://master--material-ui.netlify.app/components/popover/#anchor-playground
=> we can't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going back to the original implementation.
Adds a programmatically focusable marker before the demo which can be focused via a button in the toolbar.
some goals: