Skip to content

refactor(splitter): Improved ARIA semantics and code organization#2145

Open
rkaraivanov wants to merge 1 commit intomasterfrom
rkaraivanov/splitter-improvements
Open

refactor(splitter): Improved ARIA semantics and code organization#2145
rkaraivanov wants to merge 1 commit intomasterfrom
rkaraivanov/splitter-improvements

Conversation

@rkaraivanov
Copy link
Member

Description

Replace [start-collapsed] / [end-collapsed] reflected attributes with CSS custom states via ElementInternals (addInternalsController). Collapsed panes are now exposed as :state(start-collapsed) / :state(end-collapsed), keeping the public API surface clean.

  • Extract internal types (PanePosition, SplitterPaneState, PaneResizeSnapshot, SplitterResizeState, event maps) into a dedicated types.ts module
  • Embed StyleInfo directly in SplitterPaneState to eliminate separate _startPaneInternalStyles / _endPaneInternalStyles / _barInternalStyles fields
  • Replace mutation-by-spread with direct property assignment on pane state objects
  • Rename _barRef_separatorRef for semantic clarity; remove _updateCursor() (cursor now set inline via styleMap in _renderSeparator())
  • Unify _handleExpanderStartAction / _handleExpanderEndAction into _handleExpanderAction(pane) and simplify _resolvePartNames
  • Add _isCollapsed(which), _getPaneState(which), and _isHorizontal helpers to reduce repetitive conditionals
  • Extract _renderSeparator() and _renderAccessibleLabel() render helpers; add an igc-visually-hidden label announcing current collapse state to assistive tech; set aria-labelledby on the separator element
  • Pass pre-computed totalSize into _createPaneState, _setMinMaxInPx, _setPaneMinMaxSizes, etc. to avoid redundant getBoundingClientRect calls
  • Register IgcVisuallyHiddenComponent as a sub-dependency
  • Extract KEYBOARD_RESIZE_STEP = 10 constant
  • Update base SCSS and all spec assertions to use :state(...) selectors
  • Expand Storybook: add Vertical, WithConstraints, and ProgrammaticCollapse stories; improve all control and component descriptions; fix NestedSplitters to pass inner splitters directly into named slots

Type of Change

  • Documentation update
  • Refactoring (code improvements without functional changes)

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed

Replace `[start-collapsed]` / `[end-collapsed]` reflected attributes with
CSS custom states via ElementInternals (`addInternalsController`). Collapsed
panes are now exposed as `:state(start-collapsed)` / `:state(end-collapsed)`,
keeping the public API surface clean.

- Extract internal types (`PanePosition`, `SplitterPaneState`, `PaneResizeSnapshot`,
  `SplitterResizeState`, event maps) into a dedicated `types.ts` module
- Embed `StyleInfo` directly in `SplitterPaneState` to eliminate separate
  `_startPaneInternalStyles` / `_endPaneInternalStyles` / `_barInternalStyles` fields
- Replace mutation-by-spread with direct property assignment on pane state objects
- Rename `_barRef` → `_separatorRef` for semantic clarity; remove `_updateCursor()`
  (cursor now set inline via `styleMap` in `_renderSeparator()`)
- Unify `_handleExpanderStartAction` / `_handleExpanderEndAction` into
  `_handleExpanderAction(pane)` and simplify `_resolvePartNames`
- Add `_isCollapsed(which)`, `_getPaneState(which)`, and `_isHorizontal` helpers
  to reduce repetitive conditionals
- Extract `_renderSeparator()` and `_renderAccessibleLabel()` render helpers;
  add an `igc-visually-hidden` label announcing current collapse state to assistive
  tech; set `aria-labelledby` on the separator element
- Pass pre-computed `totalSize` into `_createPaneState`, `_setMinMaxInPx`,
  `_setPaneMinMaxSizes`, etc. to avoid redundant `getBoundingClientRect` calls
- Register `IgcVisuallyHiddenComponent` as a sub-dependency
- Extract `KEYBOARD_RESIZE_STEP = 10` constant
- Update base SCSS and all spec assertions to use `:state(...)` selectors
- Expand Storybook: add `Vertical`, `WithConstraints`, and `ProgrammaticCollapse`
  stories; improve all control and component descriptions; fix `NestedSplitters`
  to pass inner splitters directly into named slots
@rkaraivanov rkaraivanov requested a review from ddaribo March 13, 2026 17:45
@rkaraivanov rkaraivanov added a11y When the issue or PR is related to accessibility refactoring splitter labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y When the issue or PR is related to accessibility refactoring splitter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant