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

Adding EuiModal callout for H1 rendering. #6497

Merged
merged 7 commits into from
Jan 23, 2023
Merged
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
4 changes: 1 addition & 3 deletions src-docs/src/views/color_picker/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export default () => {
modal = (
<EuiModal onClose={closeModal} style={{ width: '800px' }}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Color picker in a modal</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Color picker in a modal</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/combo_box/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ export default () => {
modal = (
<EuiModal onClose={closeModal} style={{ width: '800px' }}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Combo box in a modal</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Combo box in a modal</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>{comboBox}</EuiModalBody>
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/datagrid/advanced/ref.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@ export default () => {
{isModalVisible && (
<EuiModal onClose={closeModal} style={{ width: 500 }}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h2>Example modal</h2>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Example modal</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/datagrid/basics/datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ const trailingControlColumns = [
modal = (
<EuiModal onClose={closeModal} style={{ width: 500 }}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h2>A typical modal</h2>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>A typical modal</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
6 changes: 2 additions & 4 deletions src-docs/src/views/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export default () => {
modal = (
<EuiModal onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Modal title</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Modal title</EuiModalHeaderTitle>
Comment on lines -27 to +26
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooh, good catch on this. I did a quick grep for all instances in our docs that are doing <EuiModalHeaderTitle><h1> and unfortunately it's quite high and not just limited to the modal docs.

Would you mind doing a quick search through the src-docs/ folder for <EuiModalHeaderTitle> and removing all nested <h1>/<h2>s as part of this PR? It looks like there's at least 7 more files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll go looking for those and push back up.

Copy link
Contributor

@cee-chen cee-chen Jan 19, 2023

Choose a reason for hiding this comment

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

One more super quick note - it looks like our modal.spec.tsx and modal.a11y.tsx need to be updated as well. Apologies for missing those in my original PR!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call @cee-chen. I worked back through and spot tested the change on the ones I found.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like modal.spec.tsx and modal.a11y.tsx still need <h1>s removed, as a heads up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the modal.spec.tsx and modal.a11y.tsx files.

</EuiModalHeader>

<EuiModalBody>
Expand All @@ -34,7 +32,7 @@ export default () => {
<EuiCodeBlock language="html" isCopyable>
{`<EuiModal onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle><h1><!-- Modal title --></h1></EuiModalHeaderTitle>
<EuiModalHeaderTitle><!-- Modal title --></EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
6 changes: 3 additions & 3 deletions src-docs/src/views/modal/modal_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const modalWidthSource = require('!!raw-loader!./modal_width');

const modalSnippet = `<EuiModal onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle><h1><!-- Modal title --></h1></EuiModalHeaderTitle>
<EuiModalHeaderTitle><!-- Modal title --></EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand All @@ -46,7 +46,7 @@ const modalSnippet = `<EuiModal onClose={closeModal}>

const modalWidthSnippet = `<EuiModal style={{ width: 800 }} onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle><h1><!-- Modal title --></h1></EuiModalHeaderTitle>
<EuiModalHeaderTitle><!-- Modal title --></EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand All @@ -60,7 +60,7 @@ const modalWidthSnippet = `<EuiModal style={{ width: 800 }} onClose={closeModal}

const modalFormSnippet = `<EuiModal onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle><h1><!-- Modal title --></h1></EuiModalHeaderTitle>
<EuiModalHeaderTitle><!-- Modal title --></EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/modal/modal_form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ export default () => {
modal = (
<EuiModal onClose={closeModal} initialFocus="[name=popswitch]">
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Modal title</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Modal title</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>{formSample}</EuiModalBody>
Expand Down
6 changes: 2 additions & 4 deletions src-docs/src/views/modal/modal_width.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export default () => {
modal = (
<EuiModal style={{ width: 800 }} onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Modal title</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Modal title</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand All @@ -34,7 +32,7 @@ export default () => {
<EuiCodeBlock language="html" isCopyable>
{`<EuiModal style={{ width: 800 }} onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle><h1><!-- Modal title --></h1></EuiModalHeaderTitle>
<EuiModalHeaderTitle><!-- Modal title --></EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/toast/guidelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default () => {
<EuiModal onClose={closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Your visualization has an error</h1>
Your visualization has an error
</EuiModalHeaderTitle>
</EuiModalHeader>

Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/window_event/basic_window_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import { ModalExample } from './modal_example_container';
const BasicModal = ({ onClose }) => (
<EuiModal onClose={onClose} style={{ width: '800px' }}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Example modal</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Example modal</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
<p>
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/window_event/window_event_conflict.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ const ConflictModal = (props) => {
return (
<EuiModal onClose={props.onClose} style={{ width: '800px' }}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Example modal</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Example modal</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
<EuiFieldText
Expand Down
4 changes: 1 addition & 3 deletions src/components/modal/modal.a11y.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ const Modal = () => {
{isModalVisible && (
<EuiModal {...modalProps}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Title of modal</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Title of modal</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
4 changes: 1 addition & 3 deletions src/components/modal/modal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ const Modal = () => {
{isModalVisible && (
<EuiModal {...modalProps}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<h1>Title of modal</h1>
</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Title of modal</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
Expand Down
3 changes: 2 additions & 1 deletion src/components/modal/modal_header_title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export type EuiModalHeaderTitleProps = FunctionComponent<
HTMLAttributes<HTMLHeadingElement> &
CommonProps & {
/**
* The tag to render
* The tag to render. Can be changed to a lower heading
* level like `h2` or a container `div`.
Comment on lines +19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks great to me, thank you for the extra specificity!

* @default h1
*/
component?: ElementType;
Expand Down