-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Contrast checker notice should not use the order CSS property #58936
Comments
Thanks for the ping @afercia 👍
The CSS property is still required as the color panel can have controls inserted via slot fills from any number of sources.
The order is still relevant as it keeps the related color controls together. I'm not sure what other solutions are available to us that wouldn't break the UI further. Perhaps we need some fresh design eyes on this one?
So I'm clear, are you saying the sequence here is meaningful or is there a problem with the focus order? I think an argument could be made here that the contrast checkers' meaning is independent from the sequence in the DOM. It's unfortunate that we can't control the order of slot fills otherwise their injection to the panel could be separated and moved to the end of the panel. I'm a little short on bandwidth at the moment, so if there is anyone that can pick this up that would be appreciated. I'd of course be happy to help out with reviews etc. |
It would be nice to understand how to replicate this scenario and actually test the UI with altered order.
It's not just about the focus order. it's also about the reading order.
To my understanding, it will only keep the visual order of the color controls together. The DOM order will not match the visual order though. |
I'm not sure I can give an explicit step-by-step recipe for testing. There are so many possibilities, it would change I think based on what your testing focus is. There are a few key points that I can note that should help you create a tailored test case:
Again, I appreciate that isn't quite what you might have been chasing but I hope it helps somewhat though. As the various inspector panels have matured a bit, it would be good to revisit the color panel as a special case. There could be some benefit to exploring multiple slots just for that panel. That could still have some backwards compatibility issues to wrangle as well as the fact that the slots would still be open to 3rd parties. I'm not sure even then we could guarantee controls aren't placed as fills in the wrong slot and/or disrupting meaningful order (visual or DOM). Unfortunately, I don't have the bandwidth to explore this further. I'd be happy to help test or review any potential solutions though 🙏 |
@aaronrobertshaw I found some time to wrap my head around this issue. Thanks for your detailed explanation, much appreciated. I played a bit with altering the Cover block code, just for testing. Still, this As a user, the See the example screenshot below. This is an user experience problem. Not sure this is ideal. Ideally there should be a way to 'attach' the |
I'm not sure this could be guaranteed given SlotFills can't guarantee the order in which their fills will be registered and rendered.
It could also be worth factoring into this discussion that the contrast checkers are really related to more than a single control or color value. The warning is based on how the selection relates to other selections for other color controls. In some circumstances, it could be argued that the contrast checker relates to the overall color configuration for the panel.
The example shown is pretty specific to the Cover block because of the two overlay-related controls. The contrast warning there makes sense given it's after the color controls but before the overlay opacity. If the contrast warning was related to the heading color and was tied to it, it would break the visual representation of grouping the color controls. I'm not arguing for or against anything here, just that that is the consequence. So to make any changes to strictly tie the contrast warning with the control it relates to would need an alternate design. If we are to try and maintain the current visuals but detach the contrast checker and color controls, then I think it comes back to earlier suggestions made about potentially introducing additional slots for the color panel. |
It's before the overlay opacity in the screenshot on the right, where I removed the order CSS property 🙂
Not sure 'breaking the visual representation' would be a huge issue. A notice or warning are supposed to appear in close proximity with the control that is invalid. That is expected. Imagine a form with many input fields. The form has user input validation. Once submitted with an invalid value, the validation error message can certainly be shown at the top or at the bottom of the form but there is the need to identify the invalid value and point users to it. Usually, the validation error is shown close to the invalid field. Instead, in this csse there's no way to identify which one of the potential multiple color settings is invalid. Imagine a block with multiple color pair settings. The notice only says 'this color combination' but there's more than one and no indication at all of which one is invalid. Plugins can also add more controls and custom blocks may provide multiple color controls and still the ContrastChecked would not indicate which setting is invalid. On top of that, the visual order and DOM order must match anyways. I will prepare a quick PR to remove the order property but I totally agree this needs to be improved and probably needs design. |
Before jumping too deep into a PR, it might pay to get that design input upfront on this one. Possible solutions can then be discussed and settled upon here. I've added the |
I think a new design and the order CSS property are two separate issues. I will submit a one-line PR to remove the order property. Anyways, I did some testing and it seems to me the contrast checker within the color group is always rendered last anyways so that I'm not sure the order property is necessary in the first place. I'd think the need for a new design and new implementation is a separate issue. The way the contrast checker is used isn't great. For example the Navigation block uses two contrast checkers for two color pair settings. When other color pairs are invalid, the UI isn't that great, honestly. Screenshot: I still think the contrast checker notice should be visually tied to the color pair it is associated to. |
Apologies for my confusion here @afercia. It appears how the contrast checkers are added changed with #48893. I also couldn't replicate the multiple contrast checkers for the navigation block but the contrast checking still appeared a bit broken. Screen.Recording.2024-04-17.at.4.08.05.PM.mp4Unfortunately, as noted before, I'm rather short on bandwidth for the foreseeable future, so I'll have to leave this issue with you. |
Thanks @aaronrobertshaw I will create a couple seeparate issues as the ContrastCheckeer appears to be buggy anyways.
For me, it doesn't work well when I set a color pair the first time. It only works when I change an already set color pair. For the navigation block specifically, I have to set/change color on both pairs to trigger both the notices. See GIF below, from latest trunk: |
@aaronrobertshaw thanks. Is this the relevant commit? d5297f2 Does that mean that, since the contrast check is performed on every render, the notice will always rendered last? |
At a glance, I don't think that's related to where a contrast checker is rendered. The Navigation block rendering its own additional contrast checkers does show the potential for the fills rendered to the color panel slot to contain additional contrast checkers. Depending on what else is rendered to the panel, those contrast checkers would not be last. Take an example where a 3rd party block adopts text and background block support which adds text and background controls plus a contrast checker. The block then also injects two custom color controls for an inner area of the block which require their own contrast checking for the a11y of that area. Without being able to guarantee the order of fills for a slot, the custom controls with their contrast checker could come before the block support controls and their contrast checker resulting in something like:
|
Thanks for the explanation @aaronrobertshaw
is exactly what I would like to see. From an usability and accessibility perspective, the contrast checked notice should appear immediately after the color pair it relates to. Otherwise, it wouldn't be clear which color pari the notice is warning about. |
Understood 👍 This brings the discussion back to my earlier comments around needing design feedback, as displaying the contrast checker as per the example structure order, would break the "item group" representation of all the color controls. |
Looking back into this issue, to my understanding
As such, i tseems to me the CSS |
The contents of the Color panel are still rendered via a slot fill for block inspector controls of block instances. You can see in the color block support hook here that it is passed an |
Description
block-editor-contrast-checker
order: 9999;
See the comment in the code at
gutenberg/packages/block-editor/src/hooks/color.scss
Lines 2 to 8 in f1cd566
Introduced in 8675f86
See the related PR description that mentions this point
#34027
I'm not sure this order property is still necessary. In any case, visual order and DOM order must always match when they affect 'meaning and operation'. Reference:
WCAG 2.2
1.3.2 Meaningful Sequence (Level A) https://www.w3.org/TR/WCAG22/#meaningful-sequence
2.4.3 Focus Order (Level A) https://www.w3.org/TR/WCAG22/#focus-order
If this CSS property is no longer necessary, we should just remove it.
If the order issue mentioned in the oroginal PR is still relevant, another solution must be found as the DOM order must match the reading order.
Cc @aaronrobertshaw
Step-by-step reproduction instructions
See instructions above.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: