Skip to content

feat: pad building blocks (toolbar, popup, settings, user list, chat) - #18

Merged
SamTV12345 merged 2 commits into
mainfrom
feat/pad-parts
Nov 23, 2026
Merged

SamTV12345 merged 2 commits into
mainfrom
feat/pad-parts

Conversation

@SamTV12345

Copy link
Copy Markdown
Member

Step 3: the parts the pad, timeslider and sheet pages are made of. Like the existing components they only read theme tokens, so colibris stays the default and etherpad-go can put its own theme on top.

New components

  • ep-toolbar, ep-toolbar-button, ep-toolbar-separator
    • Left side in the default slot, actions in slot end.
    • Arrow keys, Home and End move between buttons, and only one button is in the tab order.
    • Buttons can be toggles (aria-pressed) or show a badge; ep-toolbar-action carries { key, pressed }.
    • Below breakpoint the toolbar turns compact and moves priority="low" items into an overflow row behind a "more" button.
  • ep-avatar: initials or a picture. Text colour follows the background contrast, with an optional status dot.
  • ep-user-list
    • Your own entry has a name field (Enter or blur commits) and a colour button; others are sorted by name, unnamed users last.
    • Events: ep-user-rename, ep-user-color-request, ep-user-select.
  • ep-chat-panel
    • Messages come from .messages or as slotted ep-chat-message elements.
    • The list stays at the bottom unless the user scrolls up, and keeps its position when older messages are prepended (has-more → ep-chat-load-more).
    • Enter sends, Shift+Enter adds a line break; sticky and close buttons; readonly hides the input.
  • ep-popup
    • Non-modal panel below an anchor (settings, share, import/export).
    • Escape and outside clicks close it (not with persistent). Focus moves in on open and back to the anchor on close.
    • On narrow screens it becomes a bottom sheet.
  • ep-settings-section / ep-settings-row: label and description on the left, control on the right. Clicking the label toggles a checkbox, and the row gives the control its accessible name.
  • ep-segmented: radio-group style switch (for example light/dark).

Changes to existing components

  • ep-checkbox:
    • accessible-name for rows without a visible label.
    • focus() now reaches the inner input.
  • Author colours are now checked (safeColor) before they reach a style attribute. Lit's styleMap writes the first render as a plain string, so a colour like red;background:url(…) from another user got through in ep-chat-message and ep-user-badge.

Tests

  • Play tests for each component: keyboard, events, compact toolbar, chat scrolling, popup positioning, focus, Escape and outside click, and colour injection.
  • Story Pad/Layout shows the parts together in all themes.
  • Locally: 25 files, 130 tests.

Generated by Claude Code

- ep-toolbar / ep-toolbar-button / ep-toolbar-separator: roving tabindex,
  toggle and badge buttons, ep-toolbar-action, compact mode that moves
  priority="low" items into an overflow row
- ep-avatar: initials or picture, readable text colour, status dot
- ep-user-list: own entry with name field and colour button, others
  sorted; rename / colour / select events
- ep-chat-panel: messages via property or slot, stays at the bottom,
  keeps position when older messages are prepended, Enter sends
- ep-popup: non-modal panel below an anchor, Escape / outside click,
  focus handling, bottom sheet on narrow screens
- ep-settings-section / ep-settings-row, ep-segmented
- author colours are validated before they reach a style attribute
  (styleMap writes the first render as a string)
- story Pad/Layout shows the parts together

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012RMvvMtnCwj6ycD9fwLYVu
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Add composable pad toolbar, popup, user list, and chat components

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add theme-token-based pad components for toolbar actions, settings, users, and chat.
• Validate author colors before rendering them in inline styles.
• Export and document the components, with Storybook interaction tests and a combined layout story.
Merge Risk 🟡 Medium

Blast radius 🔴 High 💥 7 capabilities

  • 7 affected capabilities span independent functional scopes: package_public_api, pad_building_blocks_ui.
  • Both elements render the same bounded user-identity outcome: an author avatar/badge with color and fallback content.
  • The shared color helper is a rendering dependency, not an independent end-to-end capability.
  • The list presents users and provides the bounded user-management outcomes of renaming the current user, requesting a color change, and selecting another user.
  • Avatar rendering is a visual sub-capability inside this same user-presence integration, not a separate deployment scope.
  • The panel and message element together implement one end-to-end chat capability: displaying messages, preserving the reader's position, requesting older history, and emitting new-message actions.
  • EpChatMessage is an implementation hop in that path rather than a separate capability.
  • Buttons, action events, toggle state, overflow placement, and keyboard navigation form one bounded toolbar outcome.
  • The separator and overflow slot are presentation/placement parts of that same integration.
  • These elements implement one settings-form integration: grouping controls, naming them from row labels, synchronizing disabled state, and changing a selected option.
  • The section, row, checkbox, and segmented control are connected through slotted-control behavior and share the same bounded settings outcome.
  • The popup provides the bounded overlay outcome used to host settings and other toolbar-triggered content: placement, dismissal, lifecycle events, and focus management.
  • Its slotted controls remain consumer capabilities and are not counted as separate popup capabilities.
  • This is an independent package-distribution capability: it determines whether consumers can import the newly added components.
  • It is distinct from the UI behavior implemented after import, although it exposes those components through the package boundary.
Sources

package.json[27-33]

    "./EpAvatar.js": "./dist/EpAvatar.js",
    "./EpToolbar.js": "./dist/EpToolbar.js",
    "./EpUserList.js": "./dist/EpUserList.js",
    "./EpChatPanel.js": "./dist/EpChatPanel.js",
    "./EpSettings.js": "./dist/EpSettings.js",
    "./EpPopup.js": "./dist/EpPopup.js",
    "./EpSegmented.js": "./dist/EpSegmented.js",
Behavioral complexity 🔴 High 🧩 State transitions, Coordinated invariants

  • Before, no chat panel behavior existed in this repository.
  • After, the component coordinates bottom-following versus reader-position preservation, anchor discovery, ResizeObserver callbacks, slotted versus property-provided messages, loading flags, and top-of-log load-more suppression.
  • New correctness conditions are: bottom readers follow new content; scrolled-up readers retain the same anchor; loading requests are emitted once until content/state changes; and slotted and property messages participate consistently.
  • These are new interactions rather than routine use of an existing helper.
Potential damage 🟡 Medium 🩹 Recoverable

  • If this capability regresses, a user may be unable to rename themselves, open color editing, select another user, or see the intended ordering.
  • These outcomes are recoverable by redeploying the component; an application can also retry the interaction.
  • No persistent user record is written by this component itself, although a consumer may persist an emitted rename event outside this snapshot.
  • Code restoration repairs the component.
  • Any consumer-side rename operation that already accepted an emitted event is outside the component and would require the consumer's normal correction path.
Assessed commit fb82baa
Diagram

graph TD
  App["Host app"] --> Theme["Theme tokens"] --> Toolbar["Pad toolbar"]
  Theme --> Popup["Popup panel"] --> Settings["Settings controls"]
  Theme --> Users["User list"] --> Colors["Color utility"]
  Theme --> Chat["Chat panel"] --> Colors
  App --> Popup
  App --> Users
  App --> Chat
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Single pad layout component
  • ➕ Could coordinate toolbar, settings, users, and chat state centrally.
  • ➖ Would couple reusable controls to one page layout and application behavior.
2. Native Popover API for ep-popup
  • ➕ Could delegate some dismissal and focus behavior to the browser.
  • ➖ Anchored positioning and the narrow-screen sheet would still need additional behavior.

Recommendation: Keep the composable, event-driven components: they fit the library's framework-agnostic role and allow pad, timeslider, and sheet pages to share controls. A native popover is worth evaluating separately if it can simplify popup behavior without compromising positioning or the bottom-sheet variant.

Files changed (20) +2132 / -3

Enhancement (9) +1535 / -1
EpAvatar.tsAdd author avatar element +94/-0

Add author avatar element

• Displays initials or an image with fallback, contrast-aware text, size variants, and an optional status dot. Validates the background color before applying it.

src/EpAvatar.ts

EpChatPanel.tsAdd event-driven chat panel +317/-0

Add event-driven chat panel

• Supports property-based or slotted messages, composing and sending, sticky and close actions, and read-only mode. Preserves bottom or historical scroll position as messages change and requests older messages at the top.

src/EpChatPanel.ts

EpCheckbox.tsSupport settings-row checkbox accessibility +7/-1

Support settings-row checkbox accessibility

• Adds an accessible-name property for checkboxes without visible labels. Forwards focus calls to the internal input.

src/EpCheckbox.ts

EpPopup.tsAdd anchored non-modal popup +275/-0

Add anchored non-modal popup

• Positions a panel beneath an anchor, manages focus on open and close, and reports dismissal reasons. Supports persistent mode and a narrow-screen bottom-sheet layout.

src/EpPopup.ts

EpSegmented.tsAdd segmented radio-style selector +132/-0

Add segmented radio-style selector

• Renders mutually exclusive options with keyboard navigation, disabled-option handling, and change events. Supports optional trusted SVG icons.

src/EpSegmented.ts

EpSettings.tsAdd settings sections and labeled rows +150/-0

Add settings sections and labeled rows

• Provides section headings and rows for slotted controls. Rows supply accessible names and let label clicks activate a checkbox or focus another control.

src/EpSettings.ts

EpToolbar.tsAdd responsive toolbar components +357/-0

Add responsive toolbar components

• Adds buttons and separators with action events, toggle and badge states, and roving keyboard focus. The toolbar moves low-priority items into expandable overflow below its breakpoint.

src/EpToolbar.ts

EpUserList.tsAdd participant list and self-editing controls +193/-0

Add participant list and self-editing controls

• Shows the current user first and sorts other participants by name, with unnamed users last. Emits rename, color-picker request, and optional selection events.

src/EpUserList.ts

index.tsExport new components and data types +10/-0

Export new components and data types

• Adds the pad elements and their user, chat-entry, and segmented-option types to the main library entry point.

src/index.ts

Bug fix (3) +48 / -2
EpChatMessage.tsValidate chat author colors +3/-1

Validate chat author colors

• Applies author text color through safeColor and styleMap instead of interpolating an unvalidated inline style.

src/EpChatMessage.ts

EpUserBadge.tsValidate badge background colors +3/-1

Validate badge background colors

• Uses safeColor with styleMap rather than inserting the author-provided color into an inline style string.

src/EpUserBadge.ts

color.tsShare author-color and avatar helpers +42/-0

Share author-color and avatar helpers

• Adds CSS color validation, initials extraction, and contrast-based avatar text color selection. The validation prevents crafted author colors from becoming additional style declarations.

src/internal/color.ts

Tests (6) +531 / -0
EpAvatar.stories.tsExercise avatar rendering and color safety +42/-0

Exercise avatar rendering and color safety

• Shows avatar variants and checks initials, contrast, image fallback, and rejection of a crafted color.

stories/EpAvatar.stories.ts

EpChatPanel.stories.tsExercise chat actions and scroll behavior +115/-0

Exercise chat actions and scroll behavior

• Tests sending, sticky and close actions, bottom anchoring, older-message loading, and prepend position preservation. Also covers slotted messages, read-only mode, and the empty state.

stories/EpChatPanel.stories.ts

EpPopup.stories.tsExercise popup and settings interactions +115/-0

Exercise popup and settings interactions

• Tests anchor positioning, focus, Escape and outside dismissal, persistent mode, checkbox labels, and segmented keyboard selection.

stories/EpPopup.stories.ts

EpToolbar.stories.tsExercise toolbar actions and compact overflow +107/-0

Exercise toolbar actions and compact overflow

• Tests toggle events, accessible button state, roving keyboard focus, disabled actions, overflow expansion, and restoration at wide widths.

stories/EpToolbar.stories.ts

EpUserList.stories.tsExercise participant ordering and events +64/-0

Exercise participant ordering and events

• Tests self-first sorting, rename commits, color requests, user selection, and read-only controls.

stories/EpUserList.stories.ts

PadLayout.stories.tsShow combined pad layout across themes +88/-0

Show combined pad layout across themes

• Composes the toolbar, user list, chat, and settings popup in a Pad/Layout story with selectable themes. Includes a play check that the popup is open.

stories/PadLayout.stories.ts

Documentation (1) +11 / -0
README.mdDocument pad building blocks +11/-0

Document pad building blocks

• Adds the new elements, public properties, and events to the component table. Explains application-owned event handling, theme tokens, and the combined Pad/Layout story.

README.md

Other (1) +7 / -0
package.jsonExpose individual component entry points +7/-0

Expose individual component entry points

• Adds package exports for the seven new component modules so consumers can import them individually.

package.json

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Changing priority leaves actions hidden ✓ Resolved
Description
_placeItems() restores original slots only while an element still matches [priority="low"]. If a
compact toolbar button changes from low to normal priority, it stays in the overflow slot and
remains hidden whenever the overflow row is closed.

2. Loaded chat history shifts the viewport ✓ Resolved
Description
willUpdate() identifies a prepend by comparing the last old and new message objects by reference.
When an application rebuilds existing entries while adding older messages, the comparison fails and
_afterContentChange() leaves a scrolled-up reader at the old scroll offset.

3. Slotted chat history jumps on prepend ✓ Resolved
Description
_onSlotChange() calls _afterContentChange() without capturing the prior scroll measurements or
marking an insertion as a prepend. When an application inserts older slotted messages ahead of the
visible messages, a reader who has scrolled up loses their position.

View medium (9)
4. A finished history load moves the chat ✓ Resolved
Description
updated() adjusts scroll position for message changes but only clears a flag when loading
becomes false. If a loading indicator remains present during a prepend and is removed in a later
update, its removal changes the height above the visible messages without a corresponding scroll
adjustment.

5. Renames can be sent more than once ✓ Resolved
Description
_renderSelf() overwrites _committed with the supplied user name on every render, including
renders unrelated to a name update. If a rename has been committed but the application has not yet
replaced that user record, an intervening render resets the baseline and the subsequent blur sends
the same rename again.

6. Start-aligned popups extend off-screen ✓ Resolved
Description
_position() applies only a minimum bound to the left coordinate for align="start". When the
anchor is near the viewport's right edge, the fixed-width popup extends beyond that edge, leaving
some controls inaccessible.

7. Closing a popup can strand keyboard focus ✓ Resolved
Description
updated() handles an externally assigned open = false by removing listeners, without running
_close() or returning focus. When an application controls the documented open property and
closes the popup while focus is inside it, focus is left on content that becomes hidden and no close
event is emitted.

8. Disabled settings still accept keyboard edits ✓ Resolved
Description
EpSettingsRow implements its disabled state with opacity and pointer-events: none but does not
disable its slotted control. A keyboard user can still focus and change a checkbox or other control
inside a row presented as disabled.

9. Older chat history stops loading after the first batch ✓ Resolved
Description
_onScroll sets _loadingOlder = true before firing ep-chat-load-more, and the only place that
clears it is updated() when loading changes back to false. If an app prepends older messages
without toggling loading true and then false (it is documented only as an optional indicator),
_loadingOlder stays true and ep-chat-load-more never fires again for that panel.

10. Empty-chat text stays wrong after slotted messages change ✓ Resolved
Description
render() computes empty from this.querySelector('[slot="messages"]'), but _onSlotChange only
scrolls and never calls requestUpdate(). If `` children are added after the first render, the
empty label stays visible next to the real messages. If they are removed, the label does not appear.

11. Disabled segmented switch still changes by keyboard ✓ Resolved
Description
EpSegmented uses :host([disabled]) to block pointer input but does not disable its radio buttons
or check this.disabled in _onKeydown and _choose. When the disabled control receives keyboard
focus, its buttons remain in the tab order and arrow, Home, and End keys can change value and
dispatch ep-change.

12. Settings rows don't label the custom controls ✓ Resolved
Description
_nameControl() sets aria-label on the slotted ep-segmented host, while its inner radiogroup
derives its accessible name only from the control’s label property. When a settings row supplies
the label but the segmented control has no label of its own, the radiogroup remains unnamed; other
custom controls with inner widgets may be affected by the same host-label approach.


Informational

13. Translated row labels never reach native controls ✓ Resolved
Description
For controls that are not checkboxes, _nameControl skips any control that already has an
aria-label, and that includes the one it set itself on an earlier run. When a page changes the
row's label (for example a language switch), the control keeps the old accessible name.

14. Keyboard users find the More button outside the roving order ✓ Resolved
Description
The items getter collects only light-DOM ep-toolbar-buttons, leaving the shadow-DOM More button
at its default rovingTabIndex = 0 and outside arrow-key navigation. In compact mode, a regular
button and More are both Tab stops, so users must Tab to More separately to reach the overflow row.

15. Arrow Left from no selection skips the last option ✓ Resolved
Description
In _onKeydown, when value matches no enabled option, at is -1, so ArrowLeft/ArrowUp computes
(at - 1 + n) % n = n-2 instead of the last option. The first ArrowLeft from an unselected switch
therefore lands on the second-to-last option.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

- chat: keeps the first visible message in place on any content change
  while scrolled up (rebuilt entries, slotted prepends, loading row);
  load-more re-arms when messages arrive; empty label follows slotted
  messages
- user list: rename baseline only changes with the own name
- popup: clamped to the viewport for both alignments; closing via the
  open property also emits ep-popup-close and returns focus
- settings row: disabled rows disable their control; row labels follow
  label changes (marked with data-ep-row-label) and reach ep-segmented
- segmented: disabled blocks keyboard; ArrowLeft without selection goes
  to the last option
- toolbar: items whose priority changes leave the overflow row; "more"
  is part of the roving order in compact mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012RMvvMtnCwj6ycD9fwLYVu
@SamTV12345
SamTV12345 merged commit 972270a into main Nov 23, 2026
3 checks passed
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.

1 participant