Skip to content

Don't focus trap tab by default#115

Closed
riasvdv wants to merge 1 commit into
panphora:mainfrom
riasvdv:editor-tab-accessibility
Closed

Don't focus trap tab by default#115
riasvdv wants to merge 1 commit into
panphora:mainfrom
riasvdv:editor-tab-accessibility

Conversation

@riasvdv

@riasvdv riasvdv commented Jun 12, 2026

Copy link
Copy Markdown

Fixes #113

  • Collapsed Tab/Shift+Tab now fall through to native focus behavior, while selected text still indents/outdents.
  • Added public indentSelection() / outdentSelection() line transforms, using two spaces and setRangeText(..., 'preserve').
  • Added Ctrl/Cmd+] and Ctrl/Cmd+[ to shortcuts.
  • Added preview inert / aria-hidden syncing

Summary by cubic

Stop trapping focus on Tab: collapsed Tab/Shift+Tab now move focus while selections still indent/outdent (Fixes #113). Also adds indent/outdent shortcuts and improves preview accessibility.

  • New Features

    • Public APIs: indentSelection() and outdentSelection().
    • Shortcuts: Ctrl/Cmd + ] to indent, Ctrl/Cmd + [ to outdent.
  • Bug Fixes

    • Tab no longer traps focus; with a selection it indents/outdents, otherwise it follows native focus.
    • Preview stays out of the tab order with inert/aria-hidden until Preview mode.
    • Prevent duplicate global listener initialization.

Written for commit a554161. Summary will update on new commits.

Review in cubic

panphora added a commit that referenced this pull request Jun 18, 2026
…JSON, Safari fix

Bundles several community fixes and features into one minor release.

Added:
- transformLinkUrl option for the link tooltip (#85)
- Tab/Shift+Tab indent on selection, Cmd/Ctrl+] and Cmd/Ctrl+[ shortcuts, and public indentSelection()/outdentSelection() (#115)
- JSON-aware data-ot-* parsing and data-ot-textarea-* shortcuts so textareaProps (e.g. required) works from HTML (#112)
- Autocomplete recipe for @mention/#issue popups in docs/AUTOCOMPLETE.md (#96)

Fixed:
- Keyboard focus trap: collapsed Tab/Shift+Tab now uses native focus traversal so keyboard users can leave the editor, WCAG 2.1.2 (#113)
- Toolbar accessibility following the W3C APG Toolbar pattern: roving tabindex, aria-pressed on toggle buttons only, aria-controls, menu-button semantics (#114)
- Safari: re-flow the textarea after edits so caret/wrap stop desyncing from the overlay (#116)
- exports.browser pointed to a non-existent file (overtype.iife.min.js); now overtype.min.js
- Link tooltip sanitizes the URL before opening, closing a latent javascript: vector

dist/ rebuilt from source. Full test suite passes, including the new keyboard-accessibility and toolbar a11y suites.

Claude-Session: https://claude.ai/code/session_013uxKmCY2gqHzfV2jBQq27J
@panphora

panphora commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Landed in v2.4.0 (22742e0), integrated alongside #114 with one change: I routed the indent/outdent replacement through execCommand('insertText') so it stays on the native undo stack (Ctrl/Cmd+Z reverts an indent in one step). The setRangeText path is kept only as a fallback.

Verified in a browser: collapsed Tab escapes the editor, selection Tab/Shift+Tab indents with the selection preserved, Cmd+]/Cmd+[ work, and the preview toggles inert/aria-hidden.

Thank you! Closing manually since it landed via a rebuilt combined commit rather than a direct GitHub merge.

@panphora panphora closed this Jun 18, 2026
panphora added a commit that referenced this pull request Jun 19, 2026
…JSON, Safari fix

Bundles several community fixes and features into one minor release.

Added:
- transformLinkUrl option for the link tooltip (#85)
- Tab/Shift+Tab indent on selection, Cmd/Ctrl+] and Cmd/Ctrl+[ shortcuts, and public indentSelection()/outdentSelection() (#115)
- JSON-aware data-ot-* parsing and data-ot-textarea-* shortcuts so textareaProps (e.g. required) works from HTML (#112)
- Autocomplete recipe for @mention/#issue popups in docs/AUTOCOMPLETE.md (#96)

Fixed:
- Keyboard focus trap: collapsed Tab/Shift+Tab now uses native focus traversal so keyboard users can leave the editor, WCAG 2.1.2 (#113)
- Toolbar accessibility following the W3C APG Toolbar pattern: roving tabindex, aria-pressed on toggle buttons only, aria-controls, menu-button semantics (#114)
- Safari: re-flow the textarea after edits so caret/wrap stop desyncing from the overlay (#116)
- exports.browser pointed to a non-existent file (overtype.iife.min.js); now overtype.min.js
- Link tooltip sanitizes the URL before opening, closing a latent javascript: vector

dist/ rebuilt from source. Full test suite passes, including the new keyboard-accessibility and toolbar a11y suites.
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.

Markdown editor traps keyboard focus

2 participants