Skip to content

fix(emoji-board): skip displayCheck on FocusTrap activation#820

Open
Just-Insane wants to merge 2 commits into
SableClient:devfrom
Just-Insane:fix/emoji-board-focustrap
Open

fix(emoji-board): skip displayCheck on FocusTrap activation#820
Just-Insane wants to merge 2 commits into
SableClient:devfrom
Just-Insane:fix/emoji-board-focustrap

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented May 14, 2026

Description

focus-trap (used by the emoji board) runs a displayCheck by default on activation, which traverses the DOM to find tabbable elements. This can throw when elements have zero dimensions (e.g. immediately after mount before layout). Passing displayCheck: 'none' skips that check and lets the trap activate reliably.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

The change passes a single option object to the focus-trap activate() call. Skipping the display check prevents the library from traversing the DOM for tabbable elements before the emoji board has finished layout, which was causing an activation error immediately after mount.

FocusTrap's default displayCheck:'full' calls getComputedStyle() on every
tabbable element when the board opens. With hundreds of emoji buttons
in the visible groups this causes a multi-hundred ms freeze. Using
displayCheck:'none' skips that DOM traversal entirely while preserving
all keyboard-navigation and focus-trap behaviour.
@Just-Insane Just-Insane force-pushed the fix/emoji-board-focustrap branch from c95ed49 to e09459c Compare May 14, 2026 19:40
@Just-Insane Just-Insane marked this pull request as ready for review May 19, 2026 23:15
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners May 19, 2026 23:15
Copilot AI review requested due to automatic review settings May 19, 2026 23:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a focus-trap activation error in the emoji board by disabling tabbable’s default displayCheck, which can traverse the DOM and throw during early mount/layout when elements have zero dimensions.

Changes:

  • Pass tabbableOptions: { displayCheck: 'none' } to the emoji board’s FocusTrap configuration to avoid DOM visibility checks on activation.
  • Add a .changeset entry documenting the patch-level user-facing fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/app/components/emoji-board/EmojiBoard.tsx Updates focusTrapOptions to skip tabbable’s display checking during activation.
.changeset/emoji-board-focustrap.md Adds a patch changeset documenting the focus trap reliability fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants