-
Notifications
You must be signed in to change notification settings - Fork 51
Dialog focus improvements #473
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
base: main
Are you sure you want to change the base?
Conversation
samuelpecher
left a comment
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.
Nice! I think we need to move some code around close to the the appropriate place.
1e7b94e to
9549e2e
Compare
|
@samuelpecher would love your input on these changes 🙏 |
f00e783 to
a8bfb16
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.
This is a great improvement to the toolbar DOM, and any interaction we can drop is always a win. 🎉
I think the toggle/open/close situation can have clearer responsibilities and I've got a couple more nits.
I'll drop the state update callback mechanism and roll it up into a sigh, beforetoggle handler<details> doesn't have that event~~
a388ebb to
5781f6f
Compare
cf8c4bf to
fbd2b87
Compare
ac3c73c to
4d3c8f3
Compare
Focus on first interactive element on open Dialogs renamed to dropdown CSS fixes Test failure fixes
The `required` attribute will be added on toggle
4d3c8f3 to
d7cf4f0
Compare
| if (newState === "open") { | ||
| this.editor.getEditorState().read(() => { | ||
| this.#updateColorButtonStates($getSelection()) | ||
| }) | ||
| } |
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.
Just a general thought: I removed the callbacks yet I don't love a toolbar summary reaching into the editor like this. It's the trade-off for not scaffolding a whole series of callbacks.
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.
Again, I love the markup we can get with details and now the open/close flow of the drop-downs is clear in the code.
Just added a simplification and a few nits.
👏👏👏
d7cf4f0 to
dfbf103
Compare
dfbf103 to
17496b6
Compare
|
@jorgemanrubia would you mind taking a look at these changes? 🙏 |
Dialog to details
For the two existing toolbar dialogs, this PR changes their structure to
<details>, similar to the overflow menu. This enables us to remove a lot of extra JS code that came with using<dialog>.Tab indexes
Changed how tabindexes are assigned. Instead of giving them all a unique value, they all get 0, as per MDN specs. This simplifies the code but still follows the visual layout of the elements. Plus with the above change, the open dropdowns are now logically placed in the tab order.