Skip to content

feat(button)!: port to <pf-v6-button> - #3157

Open
ArathyKumar wants to merge 13 commits into
staging/pfv6from
feat/pf-button
Open

feat(button)!: port to <pf-v6-button>#3157
ArathyKumar wants to merge 13 commits into
staging/pfv6from
feat/pf-button

Conversation

@ArathyKumar

@ArathyKumar ArathyKumar commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What I did

Ported the existing pf-v5-button Web Component to a new pf-v6-button Web Component that follows design and provides feature parity with the PatternFly v6 Button React component.

button-variants

Changes

  • Ported pf-v5-button to pf-v6-button.
  • Updated the component to match the PFv6 Button design and styles.
  • Aligned the Web Component API and behaviour with the PFv6 React component.
  • Added support for PatternFly v6 button variants:
    • primary
    • secondary
    • tertiary
    • danger
    • warning
    • plain
    • link
    • control
    • stateful
  • Added support for button sizes and states.
  • Added support for loading and disabled states.
  • Added support for block buttons.
  • Added support for icons and icon positioning.
  • Added support for href for link-style buttons.
  • Added support for button, submit, and reset types.
  • Maintained form-associated behaviour using native Web Component APIs.
  • Updated tests and demos
  • Added the required changeset.

Testing Instructions

  • Run the pf-v6-button Web Component tests and verify that they pass.
  • Verify the pf-v6-button API and behaviour.
  • Verify all supported button variants, sizes, and states.
  • Verify loading and disabled states.
  • Verify keyboard navigation and focus behaviour.
  • Verify form submission and reset behaviour for button, submit, and reset types.
  • Verify accessibility behaviour.
  • Verify the pf-v6-button demo and confirm that it matches the PatternFly v6 React Button in appearance and behaviour.

Notes to Reviewers

This PR ports the existing pf-v5-button Web Component to pf-v6-button and brings it in line with the PatternFly v6 React Button.

For more details about the requirements and expected behavior, please refer to the related issue #2984.

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 72754ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@patternfly/elements Major
@patternfly/pfe-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

✅ Commitlint tests passed!

More Info
{
  "valid": true,
  "errors": [],
  "warnings": [],
  "input": "feat(button)!: port to `<pf-v6-button>`"
}

@github-actions github-actions Bot added the AT passed Automated testing has passed label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

SSR Test Run for 10c4b9a: Report

Prevent Chromium Tab-wrap flakiness with a trailing focus sentinel, stop
RovingTabindexController from stealing focus after Tab-out, pin timestamp
fixtures to en-US, and add the missing major changeset for the v5→v6 button port.

Assisted-By: Cursor
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Deploy Preview for patternfly-elements ready!

Name Link
🔨 Latest commit 2b64417
😎 Deploy Preview https://deploy-preview-3157--patternfly-elements.netlify.app/

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

SSR Test Run for 5244ae5: Report

@zeroedin zeroedin changed the title feat(button): port <pf-v5-button> to <pf-v6-button> feat(button)!: port to <pf-v6-button> Aug 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

SSR Test Run for 218ac93: Report

@github-actions

Copy link
Copy Markdown
Contributor

SSR Test Run for e6afc83: Report

…check

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	elements/pf-v5-clipboard-copy/pf-v5-clipboard-copy.ts
#	elements/pf-v5-tooltip/demo/block-triggers.html
#	elements/pf-v5-tooltip/demo/flip.html
#	elements/pf-v5-tooltip/demo/performance.html
#	elements/pf-v5-tooltip/demo/trigger.html
#	elements/pf-v5-tooltip/docs/pf-v5-tooltip.md
@github-actions

Copy link
Copy Markdown
Contributor

SSR Test Run for c7f1b89: Report

@github-actions

Copy link
Copy Markdown
Contributor

SSR Test Run for d2df39e: Report

@github-actions

Copy link
Copy Markdown
Contributor

SSR Test Run for 56e2f06: Report

@github-actions

Copy link
Copy Markdown
Contributor

SSR Test Run for cdb0e95: Report

@github-actions

This comment has been minimized.

@ArathyKumar
ArathyKumar marked this pull request as ready for review August 24, 2026 14:19
@adamjohnson

Copy link
Copy Markdown
Collaborator

@ArathyKumar, Since we don't hvae Qodo enabled for this repo: have you had an agent review this PR yet?

I had Grok review it in the Qodo style. This feedback will need to be vetted. Results below:

AI review results

Code Review

🐞 Bugs (3)


1. expanded cannot be false in HTML 🐞 Bug ⚙ API

Description

expanded is an optional reflected Boolean, so markup can only turn it on. The hamburger demo assigns expanded = false in script because a collapsed hamburger has no HTML form. updated() then console.errors for <pf-v6-button hamburger> with no expanded attribute.

Code

elements/pf-v6-button/pf-v6-button.ts L198–L199

@property({ reflect: true, type: Boolean }) expanded?: boolean;

elements/pf-v6-button/demo/hamburger.html L32–L35

// `expanded` is required whenever `hamburger` is set; boolean attributes
// can only express "true", so these two are set to `false` via JS.
document.getElementById('default').expanded = false;

Relevance: Strong. Public HTML API; hard to change after release.

Evidence

willUpdate maps expanded === undefined to aria-expanded: null, so the implementation depends on a third state HTML cannot express. React can pass isExpanded={false}; this element cannot.

pf-v6-button.ts L264–L265, L284–L292

Agent prompt

The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`expanded` is an optional reflected Boolean (`expanded?: boolean`). HTML authors cannot express a collapsed hamburger (`expanded={false}`). The hamburger demo sets `expanded = false` via JS, and `updated()` console.errors when `hamburger` is set and `expanded` is `undefined`.

### Issue Context
Boolean attributes are true when present and false when absent. `aria-expanded` should apply only when `hamburger` is set, so a missing `expanded` attribute can mean collapsed without leaking `aria-expanded="false"` onto every button.

### Fix Focus Areas
- Keep `expanded` as a normal boolean (absent = false).
- Set `aria-expanded` only when `hamburger` is true: `String(!!this.expanded)`.
- Drop the `expanded === undefined` console.error for markup that omits the attribute.
- Update `demo/hamburger.html` so collapsed hamburgers work with no script.

- elements/pf-v6-button/pf-v6-button.ts[198-199]
- elements/pf-v6-button/pf-v6-button.ts[264-265]
- elements/pf-v6-button/pf-v6-button.ts[284-292]
- elements/pf-v6-button/demo/hamburger.html[6-36]

2. href buttons miss PatternFly focus styles 🐞 Bug ♿ A11y

Description

Focus chrome is selected with :host(:focus) #button. With href set, willUpdate removes the host tabindex and the inner <a id="button"> takes focus, so those selectors never match. :host also sets outline: none. Keyboard focus on link buttons does not get the PatternFly hover/focus treatment.

Code

elements/pf-v6-button/pf-v6-button.ts L271–L273

if (isLink) {
  this.removeAttribute('tabindex');
  this.#internals.role = 'none';

elements/pf-v6-button/pf-v6-button.css L1052–L1053

:host(:focus) #button,
:host(:focus-visible) #button {

Relevance: Strong. Keyboard users hit this on every href button, including demo/links-as-buttons.html.

Evidence

The inner <a id="button"> is the focused node. :host(:focus) is false. #button:focus / :host(:focus-within) are not used. Demos set target="_blank" with no rel.

pf-v6-button.ts L386–L401, pf-v6-button.css L404

Agent prompt

The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Focus styles are gated on `:host(:focus) #button`. For `href` buttons, focus moves to the inner `<a id="button">` and the host `tabindex` is removed, so PatternFly focus/hover token mapping never applies. `:host { outline: none }` also removes the host focus ring.

### Issue Context
Non-link buttons focus the host (`role="button"`). Link buttons focus the inner anchor (`role="none"` on the host). Selectors must cover both.

### Fix Focus Areas
- Apply the same focus token mapping for `:host(:focus) #button`, `:host(:focus-visible) #button`, and `#button:focus-visible` (or `:host(:focus-within) #button`).
- Restore a visible focus ring consistent with PatternFly (do not leave `:host { outline: none }` without a replacement).
- Add a keyboard-focus assertion or demo check for `href` buttons.
- Consider `rel="noopener noreferrer"` when `target="_blank"`.

- elements/pf-v6-button/pf-v6-button.ts[271-281]
- elements/pf-v6-button/pf-v6-button.ts[386-401]
- elements/pf-v6-button/pf-v6-button.css[399-405]
- elements/pf-v6-button/pf-v6-button.css[1052-1074]
- elements/pf-v6-button/demo/links-as-buttons.html

3. willUpdate overwrites tabindex every render 🐞 Bug ⚙ API

Description

Enabled non-link buttons run this.tabIndex = 0 on every update. That sprouts tabindex="0" and clobbers an author tabindex="-1". React Button exposes tabIndex for this; the host should keep an author-provided value.

Code

elements/pf-v6-button/pf-v6-button.ts L274–L280

} else {
  this.#internals.role = 'button';
  if (this.#disabled) {
    this.removeAttribute('tabindex');
  } else {
    this.tabIndex = 0;
  }
}

Relevance: Strong. Sprouting attributes is a documented PFE antipattern; overwriting author tabindex is a behavior bug.

Evidence

No test covers author tabindex. variant also reflects with a 'primary' default, so every instance sprouts variant="primary" as well.

pf-v6-button.ts L126, .claude/ADVICE.md “Don't sprout attributes”

Agent prompt

The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`willUpdate()` sets `this.tabIndex = 0` on every update for enabled non-link buttons. That sprouts `tabindex="0"` and overwrites author `tabindex="-1"`. `variant` is also `@property({ reflect: true })` with default `'primary'`, which sprouts `variant="primary"` on every instance.

### Issue Context
FACE hosts need to be focusable, but the spec editor (whatwg/html#8365) and PFE ADVICE.md treat sprouting attributes as an antipattern. React Button accepts `tabIndex` and should not be overridden. Default `variant` can stay `'primary'` in JS without reflecting until the author sets it.

### Fix Focus Areas
- Set host `tabIndex` to 0 only when the author has not provided `tabindex`; never clobber `tabindex="-1"`.
- Avoid initializing reflected `variant` (keep the JS default, reflect only when set).
- Add a test: `<pf-v6-button tabindex="-1">` stays `-1` after `updateComplete`.

- elements/pf-v6-button/pf-v6-button.ts[126]
- elements/pf-v6-button/pf-v6-button.ts[271-281]

@adamjohnson

Copy link
Copy Markdown
Collaborator

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai review --preview-config to test the unmerged CodeRabbit configuration on a draft PR. The requester must have repository write access; preview results are non-authoritative.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues in the current review thread, or all unresolved review comments when used in the PR conversation.
  • @coderabbitai fix-ci to automatically fix failing CI checks in a stacked pull request.
  • @coderabbitai fix-ci commit to automatically fix failing CI checks by committing fixes to the current branch.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@adamjohnson

Copy link
Copy Markdown
Collaborator

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review skipped: 123 files exceed the limit of 100.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 123 files, which is 23 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c487f6d5-7b1b-4815-8a88-017d80f90907

📥 Commits

Reviewing files that changed from the base of the PR and between afd8d0a and 72754ed.

⛔ Files ignored due to path filters (2)
  • elements/pf-v5-button/docs/screenshot.png is excluded by !**/*.png
  • elements/pf-v6-button/docs/screenshot.png is excluded by !**/*.png
📒 Files selected for processing (123)
  • .changeset/bright-buttons-port.md
  • core/pfe-core/controllers/internals-controller.ts
  • core/pfe-core/controllers/roving-tabindex-controller.ts
  • docs/_includes/_nav.njk
  • docs/_plugins/pfe-assets.cjs
  • docs/docs/develop/setup.md
  • docs/framework-integration/react.md
  • docs/framework-integration/vue.md
  • docs/get-started.md
  • docs/main.mjs
  • elements/pf-v5-accordion/demo/bordered.html
  • elements/pf-v5-accordion/demo/fixed-panel.html
  • elements/pf-v5-accordion/test/pf-accordion.spec.ts
  • elements/pf-v5-alert/README.md
  • elements/pf-v5-alert/demo/expandable.html
  • elements/pf-v5-alert/demo/timeout.html
  • elements/pf-v5-alert/demo/variations.html
  • elements/pf-v5-alert/pf-v5-alert.ts
  • elements/pf-v5-button/README.md
  • elements/pf-v5-button/demo/block.html
  • elements/pf-v5-button/demo/form-control.html
  • elements/pf-v5-button/demo/index.html
  • elements/pf-v5-button/demo/sizes.html
  • elements/pf-v5-button/demo/stateful.html
  • elements/pf-v5-button/demo/user-role.html
  • elements/pf-v5-button/demo/variants.html
  • elements/pf-v5-button/docs/CHANGELOG.old.md
  • elements/pf-v5-button/docs/pf-v5-button.md
  • elements/pf-v5-button/pf-v5-button-icon.css
  • elements/pf-v5-button/pf-v5-button-tokens.css
  • elements/pf-v5-button/pf-v5-button.css
  • elements/pf-v5-button/pf-v5-button.ts
  • elements/pf-v5-button/test/pf-button.e2e.ts
  • elements/pf-v5-button/test/pf-button.spec.ts
  • elements/pf-v5-card/demo/header-images-and-actions.html
  • elements/pf-v5-card/demo/modifiers.html
  • elements/pf-v5-card/demo/title-inline-with-images-and-actions.html
  • elements/pf-v5-card/docs/pf-v5-card.md
  • elements/pf-v5-chip/pf-v5-chip-group.ts
  • elements/pf-v5-chip/pf-v5-chip.ts
  • elements/pf-v5-clipboard-copy/demo/inline-compact.html
  • elements/pf-v5-clipboard-copy/docs/pf-v5-clipboard-copy.md
  • elements/pf-v5-clipboard-copy/pf-v5-clipboard-copy.ts
  • elements/pf-v5-dropdown/demo/custom-toggle.html
  • elements/pf-v5-dropdown/demo/disabled-item.html
  • elements/pf-v5-dropdown/docs/pf-v5-dropdown.md
  • elements/pf-v5-dropdown/pf-v5-dropdown.css
  • elements/pf-v5-dropdown/pf-v5-dropdown.ts
  • elements/pf-v5-hint/demo/index.html
  • elements/pf-v5-hint/demo/with-title.html
  • elements/pf-v5-hint/docs/pf-v5-hint.md
  • elements/pf-v5-hint/pf-v5-hint.css
  • elements/pf-v5-jump-links/demo/scrollspy-with-subsections.html
  • elements/pf-v5-label-group/pf-v5-label-group.ts
  • elements/pf-v5-label-group/test/pf-label-group.spec.ts
  • elements/pf-v5-label/pf-v5-label.css
  • elements/pf-v5-label/pf-v5-label.ts
  • elements/pf-v5-modal/demo/custom-header-footer.html
  • elements/pf-v5-modal/demo/custom-icon.html
  • elements/pf-v5-modal/demo/description.html
  • elements/pf-v5-modal/demo/index.html
  • elements/pf-v5-modal/demo/no-header.html
  • elements/pf-v5-modal/demo/overflowing-content.html
  • elements/pf-v5-modal/demo/styling.html
  • elements/pf-v5-modal/demo/top-aligned.html
  • elements/pf-v5-modal/demo/trigger-attribute.html
  • elements/pf-v5-modal/demo/variants.html
  • elements/pf-v5-modal/demo/warning-alert.html
  • elements/pf-v5-modal/docs/pf-v5-modal.md
  • elements/pf-v5-modal/test/pf-modal.spec.ts
  • elements/pf-v5-popover/README.md
  • elements/pf-v5-popover/demo/alert.html
  • elements/pf-v5-popover/demo/content.html
  • elements/pf-v5-popover/demo/edge-of-viewport.html
  • elements/pf-v5-popover/demo/flip.html
  • elements/pf-v5-popover/demo/icons.html
  • elements/pf-v5-popover/demo/index.html
  • elements/pf-v5-popover/docs/pf-v5-popover.md
  • elements/pf-v5-popover/pf-v5-popover.ts
  • elements/pf-v5-popover/test/pf-popover.spec.ts
  • elements/pf-v5-search-input/demo/disabled.html
  • elements/pf-v5-search-input/demo/pf-search-input-with-submit.html
  • elements/pf-v5-search-input/pf-v5-search-input.ts
  • elements/pf-v5-search-input/test/pf-search-input.spec.ts
  • elements/pf-v5-select/test/pf-select.spec.ts
  • elements/pf-v5-table/pf-v5-th.ts
  • elements/pf-v5-table/pf-v5-tr.ts
  • elements/pf-v5-tabs/demo/dynamic-tabs.html
  • elements/pf-v5-text-area/demo/validated.html
  • elements/pf-v5-text-input/demo/validation.html
  • elements/pf-v6-button/README.md
  • elements/pf-v6-button/demo/aria-disabled.html
  • elements/pf-v6-button/demo/block-level.html
  • elements/pf-v6-button/demo/call-to-action.html
  • elements/pf-v6-button/demo/circle-buttons.html
  • elements/pf-v6-button/demo/counts.html
  • elements/pf-v6-button/demo/disabled.html
  • elements/pf-v6-button/demo/favorite.html
  • elements/pf-v6-button/demo/hamburger.html
  • elements/pf-v6-button/demo/index.html
  • elements/pf-v6-button/demo/inline-link-as-span.html
  • elements/pf-v6-button/demo/links-as-buttons.html
  • elements/pf-v6-button/demo/plain-with-no-padding.html
  • elements/pf-v6-button/demo/progress.html
  • elements/pf-v6-button/demo/settings.html
  • elements/pf-v6-button/demo/small-buttons.html
  • elements/pf-v6-button/demo/stateful.html
  • elements/pf-v6-button/demo/variations.html
  • elements/pf-v6-button/docs/pf-v6-button.md
  • elements/pf-v6-button/pf-v6-button.css
  • elements/pf-v6-button/pf-v6-button.ts
  • elements/pf-v6-button/test/pf-v6-button.spec.ts
  • elements/pf-v6-timestamp/test/pf-timestamp.spec.ts
  • elements/pf-v6-tooltip/demo/color-scheme.html
  • elements/pf-v6-tooltip/demo/index.html
  • elements/pf-v6-tooltip/demo/manual-trigger.html
  • elements/pf-v6-tooltip/demo/options.html
  • elements/pf-v6-tooltip/demo/placement.html
  • elements/pf-v6-tooltip/demo/trigger-element.html
  • elements/pf-v6-tooltip/demo/trigger-ref.html
  • tools/pfe-tools/dev-server/plugins/templates/index.html
  • tools/pfe-tools/test/a11y-snapshot.ts
  • tools/pfe-tools/test/config.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

AT passed Automated testing has passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants