Skip to content

Conversation

@zoltanhosszu
Copy link
Contributor

@zoltanhosszu zoltanhosszu commented Nov 28, 2025

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.

Copy link
Contributor

@samuelpecher samuelpecher left a 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.

@zoltanhosszu zoltanhosszu marked this pull request as draft December 1, 2025 16:54
@zoltanhosszu zoltanhosszu force-pushed the dialog-focus-improvements branch 2 times, most recently from 1e7b94e to 9549e2e Compare December 2, 2025 10:04
@zoltanhosszu zoltanhosszu marked this pull request as ready for review December 2, 2025 10:05
@zoltanhosszu
Copy link
Contributor Author

@samuelpecher would love your input on these changes 🙏

@zoltanhosszu zoltanhosszu force-pushed the dialog-focus-improvements branch 2 times, most recently from f00e783 to a8bfb16 Compare December 2, 2025 10:16
Copy link
Contributor

@samuelpecher samuelpecher left a 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 beforetoggle handler sigh, <details> doesn't have that event~~

@samuelpecher samuelpecher force-pushed the dialog-focus-improvements branch from a388ebb to 5781f6f Compare December 2, 2025 12:33
@zoltanhosszu zoltanhosszu force-pushed the dialog-focus-improvements branch from cf8c4bf to fbd2b87 Compare December 2, 2025 15:43
@zoltanhosszu zoltanhosszu marked this pull request as draft December 2, 2025 15:46
@zoltanhosszu zoltanhosszu force-pushed the dialog-focus-improvements branch 3 times, most recently from ac3c73c to 4d3c8f3 Compare December 3, 2025 09:44
zoltanhosszu and others added 4 commits December 3, 2025 10:45
Focus on first interactive element on open
Dialogs renamed to dropdown
CSS fixes
Test failure fixes
The `required` attribute will be added on toggle
@zoltanhosszu zoltanhosszu force-pushed the dialog-focus-improvements branch from 4d3c8f3 to d7cf4f0 Compare December 3, 2025 09:45
@zoltanhosszu zoltanhosszu marked this pull request as ready for review December 3, 2025 10:00
Comment on lines +52 to +56
if (newState === "open") {
this.editor.getEditorState().read(() => {
this.#updateColorButtonStates($getSelection())
})
}
Copy link
Contributor

@samuelpecher samuelpecher Dec 3, 2025

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.

Copy link
Contributor

@samuelpecher samuelpecher left a 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.

👏👏👏

@zoltanhosszu zoltanhosszu force-pushed the dialog-focus-improvements branch from d7cf4f0 to dfbf103 Compare December 3, 2025 14:15
@zoltanhosszu zoltanhosszu force-pushed the dialog-focus-improvements branch from dfbf103 to 17496b6 Compare December 3, 2025 14:25
@zoltanhosszu
Copy link
Contributor Author

@jorgemanrubia would you mind taking a look at these changes? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants