Skip to content

Keep the carousel still when arrow keys are pressed on a button or link inside a card - #5917

Merged
Eugene (OEvgeny) merged 5 commits into
mainfrom
OEvgeny/fix-carousel-button-arrow-scroll
Oct 20, 2026
Merged

Eugene (OEvgeny) merged 5 commits into
mainfrom
OEvgeny/fix-carousel-button-arrow-scroll

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

LEFT/RIGHT on a button inside a carousel card scroll the carousel, then it scrolls back.

Changelog Entry

Fixed

  • Fixed LEFT/RIGHT on a button inside a carousel card scrolling the carousel, in PR #5917, by @OEvgeny

Description

On a button inside a card, the browser scrolled the carousel by 40 pixels and react-film centered the card again half a second later; holding the key scrolled the focused button out of view. LEFT/RIGHT now do nothing on buttons, links, and checkboxes inside a card.

Design

  • An allow-list of controls whose only native arrow action is scrolling (buttons, links, checkboxes, role="button", role="link"), not a deny-list of inputs, so text inputs, radio buttons, selects, dates, media, and focusable scroll regions keep their native arrow keys.

Specific Changes

  • CarouselFilmStrip.js: prevent the default of LEFT/RIGHT on those controls inside a card
  • carousel/navigation.arrowKeys.button.html: new test, snapshots 3–5 and 8–9, a hero card button and an Adaptive Card container with Action.OpenUrl (role="link") keep focus and the carousel does not scroll
  • carousel/navigation.arrowKeys.formControls.html: RIGHT on buttons no longer waits for a scroll; snapshots 4–7: TAB centers the hero card (Scroll carousel cards into view when focused with Tab #5926), then LEFT/RIGHT on its button keep it still
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@OEvgeny
Eugene (OEvgeny) marked this pull request as ready for review October 19, 2026 19:26
Copilot AI balanced review requested due to automatic review settings October 19, 2026 19:26

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@OEvgeny
Eugene (OEvgeny) force-pushed the OEvgeny/fix-carousel-button-arrow-scroll branch from b29c90d to 502e311 Compare October 20, 2026 02:23
Eugene Olonov added 4 commits October 20, 2026 11:26
On a control without its own arrow keys (button, link, checkbox), the
browser scrolled the carousel by 40 px and react-film centered the card
again about 500 ms later; a held key scrolled the focused button out of
view. Text inputs, radio buttons, selects, dates, and media keep their
arrow keys.
… card

Adaptive Cards render a selectAction with Action.OpenUrl on a Container,
Column, or Image as <div tabindex="0" role="link">; add [role="link"]
to the controls whose LEFT/RIGHT do nothing inside a card, and test it.
@OEvgeny
Eugene (OEvgeny) force-pushed the OEvgeny/fix-carousel-button-arrow-scroll branch from 502e311 to 36123c1 Compare October 20, 2026 18:26
@OEvgeny
Eugene (OEvgeny) enabled auto-merge (squash) October 20, 2026 19:45
@OEvgeny
Eugene (OEvgeny) merged commit 1ca95e1 into main Oct 20, 2026
32 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-carousel-button-arrow-scroll branch October 20, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants