feat(text-editor): align hyperlink dialog with fusion DS#7857
feat(text-editor): align hyperlink dialog with fusion DS#7857tomdavies73 merged 2 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Aligns the TextEditor “Insert link” dialog with the Fusion design system and improves accessibility by moving from a disabled “Save” button to submit-time validation, while also enhancing UX by pre-filling link text from the current selection.
Changes:
- Updated hyperlink dialog copy/labels and introduced new i18n keys for required-field guidance and validation messages.
- Implemented submit-time validation (instead of disabling the Save button) and auto-population of “Link text” from selected editor content.
- Added/updated Storybook interaction coverage and unit tests for the new behaviors.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/locales/locale.ts | Extends TextEditor hyperlink locale shape with new optional keys. |
| src/locales/en-gb.ts | Updates hyperlink dialog copy and adds required-field + validation message strings. |
| src/components/text-editor/text-editor-interaction.stories.tsx | Adds an interaction story to open the hyperlink dialog. |
| src/components/text-editor/internal/ui/Toolbar/toolbar.test.tsx | Adds unit tests for selected-text prefill and submit-time validation. |
| src/components/text-editor/internal/ui/Toolbar/toolbar.component.tsx | Implements new dialog layout, selection prefill, and validation flow. |
| src/components/text-editor/internal/ui/Toolbar/buttons/hyperlink.test.tsx | Updates expected dialog title text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <CarbonProvider validationRedesignOptIn> | ||
| <StyledToolbarWrapper |
There was a problem hiding this comment.
Wrapping the Toolbar in CarbonProvider will override any theme provided by a parent ThemeProvider/CarbonProvider (it defaults theme to sageTheme) and also re-initialises scoped tokens + modal context. This can cause the TextEditor toolbar/dialog to render with a different theme than the rest of the app. Instead, only opt into the new validation UI by providing NewValidationContext.Provider with validationRedesignOptIn: true around the dialog (or the specific Textboxes), without introducing a nested ThemeProvider.
nineteen88
left a comment
There was a problem hiding this comment.
comment: address baking in CarbonProvider into toolbar.component as discussed offline
8080a6d to
4ed9c3e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** Omitted from coverage, tested in hyperlink button */ | ||
| /* istanbul ignore next */ | ||
| const handleSubmit = (event: React.FormEvent) => { | ||
| event.preventDefault(); | ||
|
|
||
| // Validate that both fields are not empty | ||
| const hasTextError = !linkText.trim(); | ||
| const hasUrlError = !linkUrl.trim(); | ||
|
|
There was a problem hiding this comment.
handleSubmit is still marked with /* istanbul ignore next */, but it now contains the new validation behavior being introduced in this PR. Keeping it ignored will exclude the new logic from coverage reports and the comment is no longer accurate. Consider removing the ignore or narrowing it to only the truly untestable branch(es).
There was a problem hiding this comment.
This function is intentionally excluded from coverage. Lexical's internal architecture makes deterministic test coverage difficult to achieve, and this is a known ongoing challenge across the codebase.
Existing tests provide meaningful behavioural coverage, but removing the /* istanbul ignore next */ directive would introduce disproportionate overhead to satisfy the 100% threshold without a commensurate improvement in test quality.
c9ec109 to
ef88610
Compare
LaiaSage
left a comment
There was a problem hiding this comment.
It’s possible that Accessibility may require an error summary in the future, but for now the current error handling is sufficient.
|
As discussed via DM, thanks @tomdavies73 for working on moving the focus state to the first wrong field after error displayed. It will help a lot our keyboard users 😉 |
6b8f434
|
Thanks for the updates, @tomdavies73 . |
aligns the hyperlink dialog within the TextEditor component with designs from the fusion DS. This fixes a current accessibility issue where the "Save" button is disabled if any of the required fields are empty. This has instead been replaced with validation when the parent form is submitted. This PR also introduces some new behaviour, when a user selects text before pressing the "Hyperlink button" this selected text is populated in the "link text" textbox when the dialog opens fix #7826
|
🎉 This PR is included in version 158.46.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fix #7826
Proposed behaviour
Aligns the "hyperlink"
Dialogwithin theTextEditorcomponent with designs from the fusion DS. This fixes a current accessibility issue where the "Save"Buttonis disabled if any of the required fields are empty. This has instead been replaced with validation when the parent form is submitted.This PR also introduces some new behaviour, when a user selects text before pressing the "Hyperlink"
Buttonthis selected text is populated in the "link text"Textboxwhen theDialogopensCurrent behaviour
Currently, the "hyperlink"
Dialogwithin theTextEditorcomponent is not aligned with the fusion DS and misses some key functionality. There is also an accessibility issue due to the use of a disabled button instead of form validation.Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions
Dialogon this branch. See that the button is not disabled, and instead form validation is used if required fields are left emptyDialogwhen open to the available designs to check for proper continuity, these can be found by finding the linked Figma in the corresponding Jira tickets comments.Textboxwhen theDialogopens