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

fix(Button): form submit with Button-Link in theme 22 #3355

Merged
merged 7 commits into from
Feb 13, 2024
Merged
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion packages/react-ui/components/Button/Button.tsx
zhzz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ export class Button extends React.Component<ButtonProps, ButtonState> {

const isFocused = this.state.focusedByTab || visuallyFocused;
const isLink = use === 'link';
const isSubmit = type === 'submit';
const _isTheme2022 = isTheme2022(this.theme);

// eslint-disable-next-line react-hooks/rules-of-hooks
Expand Down Expand Up @@ -473,7 +474,14 @@ export class Button extends React.Component<ButtonProps, ButtonState> {
if (_isTheme2022 && isLink && !loading) {
captionNode = (
<ThemeContext.Provider value={getInnerLinkTheme(this.theme)}>
<Link focused={isFocused} disabled={disabled} icon={this.renderIcon2022(icon)} as="span" tabIndex={-1}>
<Link
href={isSubmit ? '#!' : ''}
zhzz marked this conversation as resolved.
Show resolved Hide resolved
focused={isFocused}
disabled={disabled}
icon={this.renderIcon2022(icon)}
as="span"
tabIndex={-1}
>
{children}
</Link>
</ThemeContext.Provider>
Expand Down