Skip to content

fix: add default aria-label to popover button and fix double-hyphen bug - #785

Open
tom-ridsdale wants to merge 2 commits into
mainfrom
blocksmith-auto-anvil/popover-aria-label-fix
Open

tom-ridsdale wants to merge 2 commits into
mainfrom
blocksmith-auto-anvil/popover-aria-label-fix

Conversation

@tom-ridsdale

@tom-ridsdale tom-ridsdale commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR addresses two accessibility issues reported in KI-419 and TU-48845 for the classic web embed popover.

  1. Default aria-label: The popover button now includes a default aria-label="Open form" for better accessibility. Customers can still override it if needed. Note that it is a hard-coded English string because translation keys don't fit this package. The embed SDK has no i18n layer at all: no locale option, no translation files, no dependency. Other hardcoded English strings do already exist, e.g.
  • create-popup.ts, create-slider.ts, create-widget.ts: closeButton.ariaLabel = 'Close'`
  • create-popover.ts and create-sidetab.ts: img alt='popover trigger icon button'
  1. Double-hyphen bug fix: Fixed a bug in the camelCaseToKebabCase utility function where non-alphabetic characters (like hyphens, numbers) were incorrectly treated as uppercase letters.

Also took the chance to update addAttributesToElement which now skips props whose value is null or undefined, so { ariaLabel: undefined } no longer sets aria-label="undefined". The helper is shared, so this also applies to iframe and the sidetab.

Related

Testing

Using the hash from this PR

// Embedded a form
<!doctype html>
<html>
  <body>
    <div data-tf-popover="brJoErE7"></div>
    <script src="https://embed.typeform.com/1bd1e019e3f05981143e864e94be4e6067f23584/embed.js"></script>
  </body>
</html>
  • aria-label set to default value "Open Form" and aria-expanded="false" ✅
image
  • aria-expanded="true" after opening the form ✅
image

-aria-expanded="false" after closing again ✅


// Embedded a form w/ override set
<!doctype html>
<html>
  <body>
    <div data-tf-popover="brJoErE7" data-tf-button-props="ariaLabel=Overriden Label"></div>
    <script src="https://embed.typeform.com/1bd1e019e3f05981143e864e94be4e6067f23584/embed.js"></script>
  </body>
</html>
  • aria-label set to configured value and aria-expanded="false" ✅
image

@github-actions github-actions Bot added the size/s label Oct 8, 2026
robespmun
robespmun previously approved these changes Oct 8, 2026
This commit addresses two accessibility issues in the web embed popover:

1. Added a default aria-label="Open form" to the popover button for
   better accessibility. Users can still override this via buttonProps.

2. Fixed a bug in camelCaseToKebabCase where non-alphabetic characters
   (like hyphens) were being treated as uppercase letters, causing
   attributes like "aria-label" to become "aria--label" with double
   hyphens. The fix now only adds hyphens before actual uppercase
   letters (A-Z).

Related: KI-419, TU-48845
@tom-ridsdale
tom-ridsdale force-pushed the blocksmith-auto-anvil/popover-aria-label-fix branch from 20d6bb2 to b78d90b Compare October 9, 2026 14:51
@tom-ridsdale
tom-ridsdale force-pushed the blocksmith-auto-anvil/popover-aria-label-fix branch from b78d90b to 9c872e3 Compare October 9, 2026 15:17
@jenkins-tf

Copy link
Copy Markdown
Collaborator

[BOT] Preview available with hash 1bd1e019e3f05981143e864e94be4e6067f23584 here.

@tom-ridsdale
tom-ridsdale marked this pull request as ready for review October 9, 2026 15:40
@tom-ridsdale
tom-ridsdale requested a review from a team as a code owner October 9, 2026 15:40
@pr-auditor

pr-auditor Bot commented Oct 9, 2026

Copy link
Copy Markdown

✅ Security Analysis Results

No security issues found. 8 files reviewed.


@pr-auditor rescan to re-run · Powered by Claude Sonnet 5.5 · Docs · #security-engineering-team

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants