Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use browser default autofocus behavior and add story for button web component #32396

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual regressions to review in the fluentui-web-components-v3 Visual Regression Report

Avatar 1 screenshots
Image Name Diff(in Pixels) Image Type
Avatar.Image.chromium.png 248 Changed

"type": "prerelease",
"comment": "remove autofocus attribute in favor of browser inheritance for button web component",
"packageName": "@fluentui/web-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
4 changes: 4 additions & 0 deletions packages/web-components/src/button/button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export default {

export const Button: Story<FluentButton> = renderComponent(storyTemplate).bind({});

export const Autofocus: Story<FluentButton> = renderComponent(html<StoryArgs<FluentButton>>`
<fluent-button autofocus>Default</fluent-button>
`);

export const Appearance: Story<FluentButton> = renderComponent(html<StoryArgs<FluentButton>>`
<fluent-button>Default</fluent-button>
<fluent-button appearance="primary">Primary</fluent-button>
Expand Down
11 changes: 0 additions & 11 deletions packages/web-components/src/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ import { ButtonType } from './button.options.js';
* @public
*/
export class BaseButton extends FASTElement {
/**
* Indicates the button should be focused when the page is loaded.
* @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#autofocus | `autofocus`} attribute
*
* @public
* @remarks
* HTML Attribute: `autofocus`
*/
@attr({ mode: 'boolean' })
public autofocus!: boolean;

/**
* Default slotted content.
*
Expand Down
Loading