Skip to content

Slider - Increased hit target #3531

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

Merged
merged 9 commits into from
Mar 16, 2025
Merged

Conversation

nitzanyiz
Copy link
Collaborator

@nitzanyiz nitzanyiz commented Feb 26, 2025

Description

Added accessible hitSlop to the slider thumb.

Changelog

Incubator.Slider - Increased thumb hitSlop.

Additional info

MADS-4591

@nitzanyiz nitzanyiz changed the title Draft: fix/slider-accessibilityHitTarget Slider - Increased hit slop Feb 26, 2025
@nitzanyiz nitzanyiz changed the title Slider - Increased hit slop Slider - Increased hit target Feb 26, 2025
@nitzanyiz nitzanyiz requested a review from Inbal-Tish February 27, 2025 12:10
@nitzanyiz nitzanyiz assigned nitzanyiz and Inbal-Tish and unassigned nitzanyiz Feb 27, 2025
@nitzanyiz nitzanyiz marked this pull request as ready for review February 27, 2025 12:10
@nitzanyiz nitzanyiz assigned adids1221 and unassigned Inbal-Tish Mar 3, 2025
@nitzanyiz nitzanyiz requested review from adids1221 and removed request for Inbal-Tish March 3, 2025 13:07
@adids1221 adids1221 assigned nitzanyiz and unassigned adids1221 Mar 3, 2025
@@ -28,14 +28,21 @@ interface ThumbProps extends ViewProps {

const SHADOW_RADIUS = 4;
const THUMB_SIZE = 24;
const THUMB_ACCESSIBLE_HITSLOP = Math.max(0, 48 - THUMB_SIZE) / 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed before, hitSlop can be Rect or number.
Since all the values are the same let's pass the THUMB_ACCESSIBLE_HITSLOP number as default.
Please check it and confirm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The thumb is view and not a pressable. For some reason view's hit slop doesn't receive number :/
https://reactnative.dev/docs/0.73/view#hitslop

@nitzanyiz nitzanyiz assigned adids1221 and unassigned nitzanyiz Mar 3, 2025
@adids1221
Copy link
Contributor

@nitzanyiz Approved as we discussed about it.
Please update int he description that the hitSlop grows when pressing on the Slider thumb.

@@ -28,14 +28,21 @@ interface ThumbProps extends ViewProps {

const SHADOW_RADIUS = 4;
const THUMB_SIZE = 24;
const THUMB_ACCESSIBLE_HITSLOP = Math.max(0, 48 - THUMB_SIZE) / 2;
const DEFAULT_THUMB_HIT_SLOP = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need the DEFAULT_THUMB_HIT_SLOP. If all sides are equal you can pass one value - THUMB_ACCESSIBLE_HITSLOP

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nitzanyiz nitzanyiz merged commit 59f5bb8 into master Mar 16, 2025
1 check passed
@nitzanyiz nitzanyiz deleted the fix/slider-accessibilityHitTarget branch March 16, 2025 07:54
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.

3 participants