Replies: 6 comments 19 replies
-
Beta Was this translation helpful? Give feedback.
-
I suppose this is tied to the conversation around separating header / footer into sub-components, but this seems like a good moment to discuss |
Beta Was this translation helpful? Give feedback.
-
Initial Sub-Component ProposalLooking at the above conversation, the key is going to be finding balance. Include simple sub-components that a high percentage of implementations will benefit from, but keep them simple so they're flexible and don't push consumers to start applying style overrides as they have to do with With that in mind, here's what I'm thinking, as a starting point. Feedback is very welcome, and we'll likely need to adjust and iterate on this list a bit as we go!
Notes:
|
Beta Was this translation helpful? Give feedback.
-
This is a good example of what I refer to when I say that our current |
Beta Was this translation helpful? Give feedback.
-
Chiming in here from #53852 (comment) I'd agree making the modal dialog easier to use and based on sub-components would be welcome. That said, the Besides cosntrained tabbing, making th erest of the content inert and non perceivable, closing on focus and the like, there is one feature that is fundamental for accessibility: the dialog needs to be labeled. We've had a few cases even in the editor where modal dialog were unlabelled. The new component must ensure the didalog is always labeled. Ideally, for better accessibility, the dialog should be labelled by the means of a visible H1 heading referenced with aria-labelledby on the element with The dialog ARIA pattern requires that:
For the sake of simplification, I'd propose that the dialog is always labelled with the H1 and Same applies to the default I think the most important thing to consider is that, while making the new component more flexible is reasonable, we also need to make sure WordPress provides accessible components that are not open to misues. Currently, some components are open to misues. For example, there have been several cases of unlabelled form controls and unlabelled modal dialogs. I'd really like all new components to avoid potential misues.
I'd agree but to some extent. The header / heading that provides the dialog labeling is arguably only 'content'. It is a required functionak part of the dialog that shouldn't be optional.
I'd argue that design often doesn't understand the modal dialog does have required features that can't be removed because, when removed, the accessibility level decreases. For example: styling the heading is perfectly legitimate. Visually hiding the heading is arguable and should be done only for very good reasons. Entirely removing the heading is a no-go. |
Beta Was this translation helpful? Give feedback.
-
As also discussed in #65203, switching from conditionally rendering the component to having an |
Beta Was this translation helpful? Give feedback.
-
@WordPress/gutenberg-components is looking into what the next version of
Modal
might look like, and we're considering (not a final decision by any means) potentially creating new component rather than simply rewriting the existing one. There are two main benefits to a new component:Dialog
)Tabs
work, where we are introducing composable sub-components, and also allowing the component to be used in both controlled and uncontrolled modes.Our goal with this sub-component based approach is to create a component that is flexible rather than opinionated. It should semantically and accessibly implement the WAI-ARIA Dialog pattern. Or goal/recommendation is to create a
Dialog
that doesn't dictate what its contents should be, and then combine that with a set of relatively generic sub-components that can be used (or not used, as needed) by consumers.This approach would allow for more freedom and flexibility, so we'd like to gather feedback on what other improvements could be made over the current
Modal
component. What's missing fromModal
? What's included inModal
but maybe doesn't work well? Or, are there any existing elements/behaviors ofModal
that we don't really need?Looking at some existing implementations of
Modal
, in the editor, the component often gets a lot of style overrides applied to it. This indicates the default design isn't up to date and/or isn't flexible enough. What are the most important features to improve that experience?One area in particular that design input would be appreciated: When reviewing the current API surface of
Modal
many, if not most, props could be eliminated using sub-components as children, making the component simpler overall. If we think of a newDialog
component as a collection of composable and/or optional sub-components, what would the ideal structure look like? What sub-components would be most useful?One thing that is already on our radar is continuing to improve the preset sizing options in a way that gives consumers easy to use options, without becoming overly restrictive or opinionated. There have been a couple of different, but related conversations around this recently:
Modal
Height Controls #55062size
prop with a fixed height #55130As work proceeds on this new component, we'll take those discussions into account and continue to iterate.
Changes the new component would likely need
There are a couple of bigger changes that we do think would be involved in a new component, based on initial analysis.
First,
Modal
is rendered conditionally with the consumer managing the state that controls it. WithDialog
, we'd use anopen
prop instead, so the implementation would be a little different thanModal
in that regard.Second,
Modal
has internal logic that's geared towards ensuring two non-nested modals cannot be opened at the same time. This isn't logic we think we'd like to carry into a new component, for a couple of reasons. First, rather than building a component that forces certain behaviors, we'd rather leave it flexible, and rely on consumers to render UIs properly and not trigger two modal dialogs at once. Also that's kind of tricky to do unless you really go out of your way to force it to happen.There will likely be other differences that surface as work continues, but before going further into the project, we wanted to get input from others on what this new component will need most.
cc @WordPress/gutenberg-design @richtabor @WordPress/gutenberg-components
(if you're reading this, please ping any other folks you think would have input to share!)
Beta Was this translation helpful? Give feedback.
All reactions