Skip to content
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

Porting BottomSheet accessibility from v2 to v4 #1288

Merged
merged 6 commits into from
Jan 3, 2024

Conversation

Mahmoud-SK
Copy link

@Mahmoud-SK Mahmoud-SK commented Feb 8, 2023

Motivation

I'm picking up this task of porting accessibility features from V2 to V4 as per #548

@Mahmoud-SK Mahmoud-SK changed the title [WIP] Porting BottomSheet accessibility from v2 to v4 Porting BottomSheet accessibility from v2 to v4 Feb 8, 2023
@jenskuhrjorgensen
Copy link

Awesome work <3

This missing functionality is what is keeping us on v2 of this library!

@BethThomas141
Copy link

Would love to see this merged in 👍

@github-actions
Copy link

github-actions bot commented Apr 6, 2023

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@BethThomas141
Copy link

Commenting to keep this open - would be a real help if this gets merged in.

@BethThomas141
Copy link

@gorhom any chance of this going in soon? 🙏

@Mahmoud-SK
Copy link
Author

We would very much also like to get this merged in. @gorhom

@manipatel30
Copy link

manipatel30 commented May 4, 2023

@gorhom Is this change available in 4.4.6 ?
Ohh sorry PR is still OPEN

@github-actions
Copy link

github-actions bot commented Jun 3, 2023

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@jenskuhrjorgensen
Copy link

Please keep this open - we are still longing for it!

@jenskuhrjorgensen
Copy link

Hi @gorhom

I'm sure you are super busy maintaining this awesome library, but can we at least get a comment on why this PR is not getting any attention? To me it is a fairly small PR that only adds some accessibility capabilities and doesn't touch any core functionality that risks breaking the lib.

Please just give us a small sign of life from you and let us know if there is anything we can do in order to get this merged <3

@gorhom gorhom self-assigned this Jun 25, 2023
@gorhom gorhom added v4 Written in Reanimated v2 v5 labels Jun 25, 2023
@Mahmoud-SK
Copy link
Author

Mahmoud-SK commented Aug 11, 2023

Hi @gorhom I see you have assigned yourself to this PR some time ago now, do you have any ETA on when we can get this reviewed and approved?

We are still very much waiting on this. ❤️

@BethThomas141
Copy link

@gorhom Please can you take a quick look at this and merge it in? My app cares about users with accessibility requirements so we really need this

@C-Dykes
Copy link

C-Dykes commented Oct 31, 2023

Any news on this? its still an issue

@jenskuhrjorgensen
Copy link

Hi again @gorhom

We are currently running on an old forked version of your awesome lib, but now we have to bump in order to get to use reanimated v3. However, since v4 of this lib still doesn't cater for accessibility users, we will unfortunately have to create a new fork of react-native-bottom-sheet, since accessibility support is being enforced in more and more countries. For instance, the European Accessibility Act (EEA) has already been implemented in several European countries including some of the countries that we operate in:

The European Accessibility Act applies to most private companies. However, it is not yet fully enacted: The legislation will be enforced by July 28, 2025, and member states have until June 28, 2022 to adopt the EAA into their national laws.
Source: https://www.boia.org/blog/european-union-accessibility-laws-an-overview

I believe this PR is fairly simple as it doesn't touch any core or complex functionality but instead just adds some additional accessibility props but if there is something that you would like to have done in a different way, please at least provide us with a review and some feedback on whatever is holding you back from reviewing/approving/merging this PR. If you have been inactive on this PR because you think "accessibility" is just dull and doesn't matter (I don't blame you if you do - I did so too) I think the EEA and below quote shows that accessibility is actually quite important and is more and more becoming a standard requirement/expected feature both by end users as well as developers:

The percentage of Americans with disabilities is a whopping 26%, which equals roughly one in four adults with disabilities on a population level. To be able to reach as many people as possible, you need to make your website accessible to people with disabilities.
Source: https://monsido.com/blog/accessibility-statistics

Looking forward to hear an answer from you that can hopefully stop our process of forking yet another version of react-native-bottom-sheet.

Best regards
Jens

Copy link

@jenskuhrjorgensen jenskuhrjorgensen left a comment

Choose a reason for hiding this comment

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

Hi @Mahmoud-SK

I've added some review comments to your PR in order to maybe make the change a little smaller in an attempt to maybe get this merged/prioritized.

Let me know what you think.

Best regards
Jens

accessibilityRole={_providedAccessibilityRole ?? undefined}
accessibilityLabel={_providedAccessibilityLabel ?? undefined}
accessibilityHint={_providedAccessiblityHint ?? undefined}
{...rest}

Choose a reason for hiding this comment

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

@Mahmoud-SK why is the spread of the rest props needed?

Copy link
Author

Choose a reason for hiding this comment

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

It's needed to pass the rest of the properties to the Animated.View - in this case it's only animatedPosition-prop.

accessible={_providedAccessible ?? undefined}
accessibilityRole={_providedAccessibilityRole ?? undefined}
accessibilityLabel={_providedAccessibilityLabel ?? undefined}
accessibilityHint={_providedAccessiblityHint ?? undefined}
Copy link

@jenskuhrjorgensen jenskuhrjorgensen Dec 5, 2023

Choose a reason for hiding this comment

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

@Mahmoud-SK can we maybe do this in order to not break the existing behaviour?

accessibilityHint ={_providedAccessiblityHint  ? _providedAccessibilityHint  : `Tap to ${
          typeof pressBehavior === 'string' ? pressBehavior : 'move'
        } the Bottom Sheet`}

Copy link
Author

Choose a reason for hiding this comment

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

Done. :)

@@ -323,7 +341,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
const extendedPositionWithKeyboard = Math.max(
0,
animatedContainerHeight.value -
(animatedSheetHeight.value + keyboardHeightInContainer)
(animatedSheetHeight.value + keyboardHeightInContainer)

Choose a reason for hiding this comment

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

I think this was correctly indented before - can you revert this change?

Copy link
Author

Choose a reason for hiding this comment

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

It looks correctly indented locally, so I'm not completely sure why it shows it like this.

adjustedSnapPoints,
adjustedSnapPointsIndexes,
Extrapolate.CLAMP
)

Choose a reason for hiding this comment

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

I think this was correctly indented before - can you revert this change?

Copy link
Author

Choose a reason for hiding this comment

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

Same as the previous comment, locally it's indented.

)
_keyboardHeight -
Math.abs(bottomInset - animatedContainerOffset.value.bottom)
)

Choose a reason for hiding this comment

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

Wasn't this also correctly indented before?

Copy link
Author

Choose a reason for hiding this comment

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

Same as the previous comment, locally it's indented.

src/components/bottomSheetBackdrop/constants.ts Outdated Show resolved Hide resolved
src/components/bottomSheet/constants.ts Show resolved Hide resolved
src/components/bottomSheetHandle/BottomSheetHandle.tsx Outdated Show resolved Hide resolved
src/components/bottomSheetHandle/constants.ts Outdated Show resolved Hide resolved
src/components/bottomSheetHandle/constants.ts Outdated Show resolved Hide resolved
accessibilityRole={_providedAccessibilityRole ?? undefined}
accessibilityLabel={_providedAccessibilityLabel ?? undefined}
accessibilityHint={_providedAccessiblityHint ?? undefined}
{...rest}
>
{children}
</Animated.View>

Choose a reason for hiding this comment

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

I think you also need to add the accessibility props to the <Animated.View> below:

    <Animated.View
      style={containerStyle}
      pointerEvents={pointerEvents}
      accessible={_providedAccessible ?? undefined}
      accessibilityRole={_providedAccessibilityRole ?? undefined}
      accessibilityLabel={_providedAccessibilityLabel ?? undefined}
      accessibilityHint={_providedAccessibilityHint ?? undefined}
      {...rest}
    >
      {children}
    </Animated.View>

Maybe add this to a local const and use that because it is the exact same component as is used inside <TapGestureHandler/> when pressBehavior !== 'none'.

Copy link
Author

Choose a reason for hiding this comment

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

Good idea, done.

@liviu-padurariu
Copy link

Hi all, is there anything stopping for this branch to be merged?

Copy link
Owner

@gorhom gorhom left a comment

Choose a reason for hiding this comment

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

thanks @Mahmoud-SK, for submitting this pr, i have left some comments. and most importantly i think we should not introduce the change announcement, since i believe it is on the user to set it up not the library.

src/components/bottomSheet/types.d.ts Outdated Show resolved Hide resolved
src/components/bottomSheet/BottomSheet.tsx Outdated Show resolved Hide resolved
src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx Outdated Show resolved Hide resolved
src/components/bottomSheetHandle/BottomSheetHandle.tsx Outdated Show resolved Hide resolved
@Mahmoud-SK
Copy link
Author

Hi @gorhom I've went ahead and done the changes that you requested. 😄 Could you please have a look again?

Thanks in advance!

@gorhom gorhom merged commit 275bd64 into gorhom:master Jan 3, 2024
@gorhom
Copy link
Owner

gorhom commented Jan 3, 2024

thanks @Mahmoud-SK for submitting this PR, i appreciate your amazing work 🙌

this should be release on the next few days

@jenskuhrjorgensen
Copy link

Awesome news, @gorhom!

The accessibility features were once added to V2 but were not added to newer versions of the lib. Will the changes in this PR be added to V5 or should we create a separate PR for that towards the V5 branch? Just to avoid having to request this feature again for the next major version.

gorhom added a commit that referenced this pull request Jan 3, 2024
* Added accessibility to the bottomSheet component

* Accessibility changes - BottomSheetBackdrop

* Accessibility changes - BottomSheetHandle

* Minor adjustments after review

* removed unused spread operator

* fix: removed change announcement

removed the change announcement part of the code, and the ..rest from the two mentioned files.
gorhom pushed a commit that referenced this pull request Jan 3, 2024
* Added accessibility to the bottomSheet component

* Accessibility changes - BottomSheetBackdrop

* Accessibility changes - BottomSheetHandle

* Minor adjustments after review

* removed unused spread operator

* fix: removed change announcement

removed the change announcement part of the code, and the ..rest from the two mentioned files.
@gorhom
Copy link
Owner

gorhom commented Jan 3, 2024

Awesome news, @gorhom!

The accessibility features were once added to V2 but were not added to newer versions of the lib. Will the changes in this PR be added to V5 or should we create a separate PR for that towards the V5 branch? Just to avoid having to request this feature again for the next major version.

I have already cherrypicked this PR into v5 latest release 👏

@TrustDec
Copy link

TrustDec commented Jan 5, 2024

Awesome news, @gorhom!
The accessibility features were once added to V2 but were not added to newer versions of the lib. Will the changes in this PR be added to V5 or should we create a separate PR for that towards the V5 branch? Just to avoid having to request this feature again for the next major version.

I have already cherrypicked this PR into v5 latest release 👏

Hi, can you take a look at this question? #1560 (comment)

Copy link

@aweary aweary left a comment

Choose a reason for hiding this comment

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

@gorhom we recently updated our fork of this library and this commit broke VoiceOver for all of our sheets. I don't think this change makes sense for any sheet that would have interactive content in it (which I imagine is most?).

I would recommend reverting, this doesn't improve accessibility at all.

accessibilityHint={`Tap to ${
typeof pressBehavior === 'string' ? pressBehavior : 'move'
} the Bottom Sheet`}
accessible={_providedAccessible ?? undefined}
Copy link

@aweary aweary Mar 4, 2024

Choose a reason for hiding this comment

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

Why would you mark the root View as accessible for the bottom sheet? That makes it so you cannot focus any of the descendant views (which is all of the sheet content) with VoiceOver on iOS.

Copy link

Choose a reason for hiding this comment

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

Yep, just tested this and this is the problem I'm seeing as well. @flo-sch I see you just opened an accessibility PR, did you want to take a look at this as well there?

haileyok added a commit to bluesky-social/react-native-bottom-sheet that referenced this pull request Apr 29, 2024
haileyok added a commit to bluesky-social/react-native-bottom-sheet that referenced this pull request Apr 29, 2024
haileyok added a commit to bluesky-social/react-native-bottom-sheet that referenced this pull request Apr 29, 2024
@haileyok
Copy link

@gorhom We also had to revert this for the same reasons aweary mentioned. I think it would probably be a good idea revert as well, especially if this has made it's way into v5.

This was referenced Sep 8, 2024
This was referenced Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v4 Written in Reanimated v2 v5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants