Skip to content

fix(#3047): Interactive elements hidden by the VisuallyHidden component don't receive Talkback virtual clicks on certain devices#3048

Closed
majornista wants to merge 19 commits intomainfrom
Issue-3047
Closed

fix(#3047): Interactive elements hidden by the VisuallyHidden component don't receive Talkback virtual clicks on certain devices#3048
majornista wants to merge 19 commits intomainfrom
Issue-3047

Conversation

@majornista
Copy link
Collaborator

@majornista majornista commented Apr 20, 2022

🐛 Bug Report
Elements like a Menu's DismissButton and the ListView's drag handle don't receive a click event when focused and triggered by Android Talkback. This seems to be device specific since it works on my Samsung Galaxy S9+ but not on other Android devices that have the same Talkback and Chrome version (e.g. Android 7.1.1 on HTC Nexus 9 using Talkback 12.1 with Chrome 100.0.4896.88). The root cause seems to be due to clip-path and/or the size of the element itself.

Base reproduction with a possible fix: https://codepen.io/majornista/pen/Exorwzq?editors=1111
bug filed: https://issuetracker.google.com/issues/229646660

🤔 Expected Behavior
Talkback should be able to trigger a click on a visually hidden element

😯 Current Behavior
Talkback isn't able to trigger a click on a visually hidden element on certain devices

💁 Possible Solution
Increasing the height/width of the visually hidden element seems to help, see codepen example.

Closes #3047

✅ Pull Request Checklist:

📝 Test Instructions:

  1. Open https://reactspectrum.blob.core.windows.net/reactspectrum/957a3ebc3e5bf9f2ece221a38e354b485b3f0585/storybook/index.html?path=/story/menutrigger--default-menu-static on an Android device with Talkback running. Note that the bug did not reproduce on a Samsung phone, but was able to be reproduced on several other Android devices.
  2. Swipe to focus, and double-tap to activate the Menu Button to expand the menu.
  3. Swipe left to move Talkback focus to the visually hidden Dismiss Button immediately preceding the menu within the popover.
  4. Double tap to activate the Dismiss Button
  5. The menu should close.

🧢 Your Project:

Adobe/Accessibility

Michael Jordan added 2 commits April 20, 2022 10:45
…nt don't receive Talkback virtual clicks on certain devices

🐛 Bug Report
Elements like a Menu's DismissButton and the ListView's drag handle don't receive a click event when focused and triggered by Android Talkback. This seems to be device specific since it works on my Samsung Galaxy S9+ but not on other Android devices that have the same Talkback and Chrome version (e.g. Android 7.1.1 on HTC Nexus 9 using Talkback 12.1 with Chrome 100.0.4896.88). The root cause seems to be due to clip-path and/or the size of the element itself.

Base reproduction with a possible fix: https://codepen.io/majornista/pen/Exorwzq?editors=1111
bug filed: https://issuetracker.google.com/issues/229646660

🤔 Expected Behavior
Talkback should be able to trigger a click on a visually hidden element

😯 Current Behavior
Talkback isn't able to trigger a click on a visually hidden element on certain devices

💁 Possible Solution
Increasing the height/width of the visually hidden element seems to help, see code pen

🧢 Your Company/Team
Adobe/Accessibility
@adobe-bot

This comment was marked as outdated.

@LFDanLu
Copy link
Member

LFDanLu commented Apr 20, 2022

Note for testing: will need to make sure that the hidden element can't be accidentally pressed now that it is 10px by 10px.. Hopefully it doesn't block presses meant for the menu/row if the user presses on the visually hidden element.

@adobe-bot

This comment was marked as outdated.

height: 1,
margin: '0 -1px -1px 0',
clip: 'rect(0 10px 10px 0)',
clipPath: 'inset(40%)',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately due to this clipPath no longer being inset(50%) I am able to click in the top left corner of the datepicker modal and close it: https://reactspectrum.blob.core.windows.net/reactspectrum/868e245a81fbaea15da6756323a666be62a5460b/storybook/index.html?path=/story/date-and-time-datepicker--default

@majornista I think I remember you saying that this clipPath change was necessary to get your Android devices to properly click the visually dismiss button via TalkBack? If so we'll have to discuss if we think this is a big enough problem to ditch this approach. Maybe we could absolutely position the visually hidden dismiss button just outside of the Dialog, not sure...

Copy link
Collaborator Author

@majornista majornista May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to ditch the approach or at least modify it. I've oftentimes thought the dismiss button should just be a big hit target placed over the visible viewport dimensions, underneath the overlay.

I think we can add style={{marginBlockStart: '-10px'}} to the DismissButton within Overlays.

@adobe-bot

This comment was marked as outdated.

@majornista majornista requested a review from LFDanLu May 9, 2022 17:19
@adobe-bot

This comment was marked as outdated.

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that I'm still able to use the DismissButton via TalkBack and VO. Open to other people's opinion on the marginBlockStart style applied to DismissButton


return (
<VisuallyHidden>
<VisuallyHidden style={{marginBlockStart: '-10px'}}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open to opinions: Maybe we should open up the api so user provided styles to the DismissButton are passed to the VisuallyHidden component? Just a bit concerned that the -10px is making an assumption about the positioning of

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LFDanLu Yeah, the -10px is based on the height of the hit target for the VisuallyHidden element, so if that were to change...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my concern there is that no one would know what to base the value on
might it be better if we allow people to pass a ref to the target? we could watch for size changes on it and adjust accordingly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could pass transform: translate(0, -100%) as needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 9ee38ed

@adobe-bot

This comment was marked as outdated.

@majornista
Copy link
Collaborator Author

@LFDanLu Would it make sense to only change the VisuallyHidden css on Android?

@adobe-bot

This comment was marked as outdated.

@LFDanLu
Copy link
Member

LFDanLu commented May 20, 2022

@LFDanLu Would it make sense to only change the VisuallyHidden css on Android?

@majornista Hm, I think that would be fair, we have precedence for platform specific fixes in other places.

@adobe-bot

This comment was marked as outdated.

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed it is working in TalkBack and VO for me. Now that DismissButton has the style prop, perhaps we should document this bug in the DismissButton docs but that can/should be followup since we need to wait for this change to be released before updating the docs.

The other docs changes should also be removed for the mean time for the above reason

@majornista majornista requested a review from LFDanLu May 24, 2022 19:26
@adobe-bot

This comment was marked as outdated.

@adobe-bot

This comment was marked as outdated.

@adobe-bot

This comment was marked as outdated.

@adobe-bot

This comment was marked as outdated.

@adobe-bot

This comment was marked as outdated.

LFDanLu
LFDanLu previously approved these changes Jun 3, 2022
Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adobe-bot
Copy link

<FocusScope restoreFocus>
<div {...overlayProps} ref={overlayRef}>
<DismissButton onDismiss={props.onClose} />
<DismissButton onDismiss={props.onClose} style={{transform: 'translate(0, -100%)'}} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these styles be built into VisuallyHidden? Requiring this addition is a breaking change for anyone that previously copied this example into their own component.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really a problem with VisuallyHidden. It's a problem with positioning the DismissButton so that it does not overlap behind a MenuItem in the overlay, and it depends on where the DismissButton is rendered in the DOM, before or after the Menu.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related comment thread: #3048 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adobe-bot
Copy link

@adobe-bot
Copy link

@adobe-bot
Copy link

@adobe-bot
Copy link

@dannify
Copy link
Member

dannify commented Aug 3, 2022

The original problem has since been testing on a couple of Android devices, none of which have this problem. The combination of the low percentage of users (only our team has reported it so far), an existing bug filed with google, and the downsides of this suggested solution is enough to just close this issue as "won't fix". We can revisit if reported in the future.

@dannify dannify closed this Aug 3, 2022
@LFDanLu LFDanLu deleted the Issue-3047 branch January 11, 2023 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interactive elements hidden by the VisuallyHidden component don't receive Talkback virtual clicks on certain devices

6 participants