Skip to content

fix(switch): make Switch toggle work on Safari - FE-7667#8004

Merged
tomdavies73 merged 3 commits into
Sage:masterfrom
quinnturner:SIT-7667
Jun 22, 2026
Merged

fix(switch): make Switch toggle work on Safari - FE-7667#8004
tomdavies73 merged 3 commits into
Sage:masterfrom
quinnturner:SIT-7667

Conversation

@quinnturner

@quinnturner quinnturner commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Proposed behaviour

Fixes #7980

Registers an on-click handler on the track to ensure that Safari appropriately handles the on click.

image image

Current behaviour

On-click for Safari doesn't work for Switch.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

I checked out locally on safari; works on all of our pages. Testing may require checking out locally to confirm or check playwright/storybook.

@quinnturner quinnturner marked this pull request as ready for review June 5, 2026 14:39
@quinnturner quinnturner requested a review from a team as a code owner June 5, 2026 14:39
Comment thread src/components/switch/switch.style.tsx Outdated
const StyledSwitchThumb = styled.span<StyledSwitchThumbProps>`
${({ $checked, $disabled, $size, $disableTransitions }) => css`
position: absolute;
pointer-events: none;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure why AI decided to set this. It can likely be removed if we want. When I hover, it still shows the pointer on Safari.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we're ok to remove this. Unless I'm missing something obvious why we need this. The MDN docs state that:

The element on its own is never the target of pointer events. However its subtree could be kept targetable by setting pointer-events to some other value. In these circumstances, pointer events will trigger event listeners on this parent element as appropriate on their way to or from the descendant during the event capture and bubble phases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, nothing to add from me, happy to approve once this is addressed 👍

Registers an on-click handler on the track to ensure that Safari appropriately handles the on click

fix Sage#7980
@tomdavies73 tomdavies73 removed their request for review June 17, 2026 08:17
@nuria1110 nuria1110 self-requested a review June 17, 2026 08:27
@tomdavies73 tomdavies73 marked this pull request as ready for review June 17, 2026 15:11
@divyajindel divyajindel marked this pull request as draft June 22, 2026 12:41
@divyajindel divyajindel marked this pull request as ready for review June 22, 2026 12:42
@tomdavies73 tomdavies73 marked this pull request as draft June 22, 2026 13:09
@tomdavies73 tomdavies73 marked this pull request as ready for review June 22, 2026 13:09
@tomdavies73 tomdavies73 merged commit 3f155fc into Sage:master Jun 22, 2026
34 checks passed
@carbonci

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 159.13.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@quinnturner quinnturner deleted the SIT-7667 branch June 26, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

[Switch]: onChange does not work on safari

6 participants