Skip to content

[OGUI-1919] Make the copy-to-clipboard component have more flexible styling - #3615

Open
isaachilly wants to merge 19 commits into
bug/ILG/OGUI-1920/Fix-encoding-order-of-filter-parameter-qfrom
improv/FRM/OGUI-1919/Make-copy-to-clipboard-component-style-flexible
Open

[OGUI-1919] Make the copy-to-clipboard component have more flexible styling#3615
isaachilly wants to merge 19 commits into
bug/ILG/OGUI-1920/Fix-encoding-order-of-filter-parameter-qfrom
improv/FRM/OGUI-1919/Make-copy-to-clipboard-component-style-flexible

Conversation

@isaachilly

@isaachilly isaachilly commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

I have JIRA issue created

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

Ticket:
Make the component more flexible, especially with regards to styling as used to always be btn-primary style and to improve the component enough that it can be used in ILG share button.

Code:

  • New optional style and failure attributes; default rendering is unchanged
  • Clipboard write is awaited and error caught by an optional onFailure handler
  • Repeat clicks restart the success timer
  • Clipboard availability is resolved once in the constructor
  • The tooltip doesn't read null if there is no message
  • No id attribute when none is passed

Reviewer:
To test onFailiure logic edit a use of the component and in console set writeText to raise an Error.

@isaachilly isaachilly changed the title Make copy button style configurable [OGUI-1920] Make copy button style configurable Sep 3, 2026
@isaachilly isaachilly self-assigned this Sep 3, 2026
@isaachilly isaachilly changed the title [OGUI-1920] Make copy button style configurable [OGUI-1919] Make copy button style configurable Sep 3, 2026
@isaachilly
isaachilly force-pushed the improv/FRM/OGUI-1919/Make-copy-to-clipboard-component-style-flexible branch 2 times, most recently from 049167c to d5f81d6 Compare September 8, 2026 12:31
@isaachilly isaachilly changed the title [OGUI-1919] Make copy button style configurable [OGUI-1919] Make copy button component more flexible Sep 8, 2026
@isaachilly
isaachilly force-pushed the improv/FRM/OGUI-1919/Make-copy-to-clipboard-component-style-flexible branch from fc6a43c to 286ef4e Compare September 9, 2026 06:59
Allow callers to override the button class and pass through inline styles, while keeping the existing primary-button default.

The button content wrapper is also centred so the default and copied states stay aligned.
Reset the success timer if clicked again otherwise the button text resets at unpredictable moments and user is left confused if the copy worked or not.
Update `CopyToClipboardComponent` to accept a `classes` suffix instead of a full `className` selector, and build the button selector from a consistent `button.btn` base.
Documented expected `vnode.attrs` fields in `CopyToClipboardComponent.view()` and added `ariaLive: 'polite'` to the status content container so copy success feedback is announced to assistive technologies.
Wrap clipboard writes in error handling and add an optional `onFailure` callback so callers can react when copying is unavailable or fails.

The component also now destructures `style` explicitly.
Done so clipboard write failures are properly caught by the existing error handling path, instead of proceeding as if copy succeeded.
On second thought if no other elements have it, I won't add here and wait for a proper strategy.
Initialise clipboard support state once in constructor and reuse it during rendering.

This removes repeated availability checks on each render and drives button disabled/title directly from persisted fields.
@isaachilly
isaachilly force-pushed the improv/FRM/OGUI-1919/Make-copy-to-clipboard-component-style-flexible branch from 31109a6 to 38ac42a Compare September 11, 2026 13:31
@isaachilly
isaachilly marked this pull request as ready for review September 11, 2026 14:17
@isaachilly
isaachilly requested a review from graduta as a code owner September 11, 2026 14:17
@isaachilly isaachilly changed the title [OGUI-1919] Make copy button component more flexible [OGUI-1919] Make the copy-to-clipboard component have more flexible styling Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant