patternfly-design icon indicating copy to clipboard operation
patternfly-design copied to clipboard

Bug - [Switch] - [Doesn't support popover]

Open Misjohns opened this issue 1 year ago • 5 comments

If a popover is required for a switch element the question-circle icon doesn't wrap along with the switch label. When the label changes from a short label to a long label the question-circle icon can appear far away from the switch element.

The question-circle icon should appear roughly 8px from the last character in the label. image

This is how it currently appears when user reduces their screen width: image

We are using this in RHTAP for Summit

Misjohns avatar May 08 '23 21:05 Misjohns

The actual dev implementation in the screenshot above is:

<Switch ... /><HelpPopover .../>

I think we can put the ? button within the switch label and it would function.

christianvogt avatar May 09 '23 15:05 christianvogt

@christianvogt while it's valid HTML, I'm not sure if that presents any sort of a11y issue. @thatblindgeye or @jessiehuff do you know if that would be an issue? I know we have a button in a label in checkbox tree view nodes, and I can't remember if this was discussed then or not - https://www.patternfly.org/v4/components/tree-view#with-checkboxes

mcoker avatar May 17 '23 22:05 mcoker

@mcoker @christianvogt in terms of putting the help popover inside the Switch label (and/or labelOff) prop is that the text label has aria-hidden="true" applied. So while you can Tab to the popover, using something like VoiceOver's navigation methods you wouldn't be able to navigate to the popover (and would have no idea there is a help popover on the page).

thatblindgeye avatar May 18 '23 19:05 thatblindgeye

Hey @Misjohns We talked about in a PatternFly meeting and thought this may be another option for this issue. Would either of these options work for your use case? My text here can be finessed by Content designers 😉

Image

andrew-ronaldson avatar Jul 11 '23 17:07 andrew-ronaldson

@andrew-ronaldson Having the ? beside a label that sits above the switch or check box resolves the accessibility concern. I'm worried that it adds more text/noise to the screen. In some cases, the additional label could provide helpful context but for other cases, the label would be very redundant with the switch/check box text (as in your example). Maybe we need to document that this pattern would only be required when a popover is needed vs. every instance of a check box or switch.

Misjohns avatar Jul 11 '23 19:07 Misjohns