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

[EuiSuperDatePicker] Fix usage within <form>s #7504

Merged
merged 5 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions changelogs/upcoming/7504.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed `EuiSuperDatePicker` submit bug when used within `<form>` elements
16 changes: 9 additions & 7 deletions src-docs/src/views/super_date_picker/super_date_picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ export default () => {
<>
{renderTimeRange()}
<EuiSpacer />
<EuiSuperDatePicker
isLoading={isLoading}
start={start}
end={end}
onTimeChange={onTimeChange}
onRefresh={onRefresh}
/>
<form>
<EuiSuperDatePicker
isLoading={isLoading}
start={start}
end={end}
onTimeChange={onTimeChange}
onRefresh={onRefresh}
/>
</form>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ exports[`EuiSuperDatePicker props accepts data-test-subj and passes to EuiFormCo
<button
class="euiSuperDatePicker__prettyFormat"
data-test-subj="superDatePickerShowDatesButton"
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -109,6 +110,7 @@ exports[`EuiSuperDatePicker props compressed is rendered 1`] = `
<button
class="euiSuperDatePicker__prettyFormat"
data-test-subj="superDatePickerShowDatesButton"
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -241,6 +243,7 @@ exports[`EuiSuperDatePicker props isDisabled config object 1`] = `
class="euiSuperDatePicker__prettyFormat euiSuperDatePicker__prettyFormat--disabled"
data-test-subj="superDatePickerShowDatesButton"
disabled=""
type="button"
>
<span
data-test-subj="customDisabledDisplay"
Expand Down Expand Up @@ -293,6 +296,7 @@ exports[`EuiSuperDatePicker props isDisabled true 1`] = `
class="euiSuperDatePicker__prettyFormat euiSuperDatePicker__prettyFormat--disabled"
data-test-subj="superDatePickerShowDatesButton"
disabled=""
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -423,6 +427,7 @@ exports[`EuiSuperDatePicker props showUpdateButton can be false 1`] = `
<button
class="euiSuperDatePicker__prettyFormat"
data-test-subj="superDatePickerShowDatesButton"
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -471,6 +476,7 @@ exports[`EuiSuperDatePicker props showUpdateButton can be iconOnly 1`] = `
<button
class="euiSuperDatePicker__prettyFormat"
data-test-subj="superDatePickerShowDatesButton"
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -542,6 +548,7 @@ exports[`EuiSuperDatePicker props width can be auto 1`] = `
<button
class="euiSuperDatePicker__prettyFormat"
data-test-subj="superDatePickerShowDatesButton"
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -610,6 +617,7 @@ exports[`EuiSuperDatePicker props width can be full 1`] = `
<button
class="euiSuperDatePicker__prettyFormat"
data-test-subj="superDatePickerShowDatesButton"
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -679,6 +687,7 @@ exports[`EuiSuperDatePicker renders 1`] = `
<button
class="euiSuperDatePicker__prettyFormat"
data-test-subj="superDatePickerShowDatesButton"
type="button"
>
Last 15 minutes
</button>
Expand Down Expand Up @@ -755,6 +764,7 @@ exports[`EuiSuperDatePicker renders an EuiDatePickerRange 1`] = `
class="euiDatePopoverButton euiDatePopoverButton--start euiDatePopoverButton-isSelected"
data-test-subj="superDatePickerstartDatePopoverButton"
title="~ 15 minutes ago"
type="button"
>
~ 15 minutes ago
</button>
Expand All @@ -775,6 +785,7 @@ exports[`EuiSuperDatePicker renders an EuiDatePickerRange 1`] = `
class="euiDatePopoverButton euiDatePopoverButton--end"
data-test-subj="superDatePickerendDatePopoverButton"
title="now"
type="button"
>
now
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`EuiSuperUpdateButton renders 1`] = `
class="euiDatePopoverButton euiDatePopoverButton--start"
data-test-subj="superDatePickerstartDatePopoverButton"
title=""
type="button"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const EuiDatePopoverButton: FunctionComponent<

const button = (
<button
type="button"
onClick={onPopoverToggle}
className={classes}
title={title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ export class EuiSuperDatePickerInternal extends Component<
return (
<EuiFormControlLayout {...formControlLayoutProps}>
<button
type="button"
className={classNames('euiSuperDatePicker__prettyFormat', {
'euiSuperDatePicker__prettyFormat--disabled': isDisabled,
})}
Expand Down
Loading