Skip to content
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
18 changes: 9 additions & 9 deletions packages/react-core/src/components/Wizard/WizardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
import { css } from '@patternfly/react-styles';
import { Button } from '../Button';
import { Title } from '../Title';
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';

export interface WizardHeaderProps {
Expand Down Expand Up @@ -31,19 +30,20 @@ export const WizardHeader: React.FunctionComponent<WizardHeaderProps> = ({
isCloseHidden,
closeButtonAriaLabel,
titleId,
descriptionComponent: Component = 'p',
descriptionComponent: Component = 'div',
descriptionId
}: WizardHeaderProps) => (
<div className={css(styles.wizardHeader)}>
{!isCloseHidden && (
<Button variant="plain" className={css(styles.wizardClose)} aria-label={closeButtonAriaLabel} onClick={onClose}>
<TimesIcon aria-hidden="true" />
</Button>
<div className={css(styles.wizardClose)}>
<Button variant="plain" aria-label={closeButtonAriaLabel} onClick={onClose}>
<TimesIcon aria-hidden="true" />
</Button>
</div>
)}

<Title headingLevel="h2" size="3xl" className={css(styles.wizardTitle)} aria-label={title} id={titleId}>
{title || <>&nbsp;</>}
</Title>
<div className={css(styles.wizardTitle)}>
<h2 className={css(styles.wizardTitleText)} id={titleId}>{title || <>&nbsp;</>}</h2>
</div>

{description && (
<Component className={css(styles.wizardDescription)} id={descriptionId}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
import { css } from '@patternfly/react-styles';
import { Button } from '../../../components/Button';
import { Title } from '../../../components/Title';
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';

export interface WizardHeaderProps {
Expand Down Expand Up @@ -31,18 +30,20 @@ export const WizardHeader: React.FunctionComponent<WizardHeaderProps> = ({
hideClose,
closeButtonAriaLabel,
titleId,
descriptionComponent: Component = 'p',
descriptionComponent: Component = 'div',
descriptionId
}: WizardHeaderProps) => (
<div className={css(styles.wizardHeader)}>
{!hideClose && (
<Button variant="plain" className={css(styles.wizardClose)} aria-label={closeButtonAriaLabel} onClick={onClose}>
<TimesIcon aria-hidden="true" />
</Button>
<div className={css(styles.wizardClose)}>
<Button variant="plain" aria-label={closeButtonAriaLabel} onClick={onClose}>
<TimesIcon aria-hidden="true" />
</Button>
</div>
)}
<Title headingLevel="h2" size="3xl" className={css(styles.wizardTitle)} aria-label={title} id={titleId}>
{title || <>&nbsp;</>}
</Title>
<div className={css(styles.wizardTitle)}>
<h2 className={css(styles.wizardTitleText)} id={titleId}>{title || <>&nbsp;</>}</h2>
</div>
{description && (
<Component className={css(styles.wizardDescription)} id={descriptionId}>
{description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ exports[`WizardHeader should match snapshot (auto-generated) 1`] = `
<div
class="pf-v5-c-wizard__header"
>
<h2
aria-label="string"
class="pf-v5-c-title pf-m-3xl pf-v5-c-wizard__title"
data-ouia-component-id="OUIA-Generated-Title-1"
data-ouia-component-type="PF4/Title"
data-ouia-safe="true"
id="string"
<div
class="pf-v5-c-wizard__title"
>
string
</h2>
<p
<h2
class="pf-v5-c-wizard__title-text"
id="string"
>
string
</h2>
</div>
<div
class="pf-v5-c-wizard__description"
id="string"
/>
<div>
ReactNode
>
<div>
ReactNode
</div>
</div>
<p />
</div>
</DocumentFragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,41 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
<div
class="pf-v5-c-wizard__header"
>
<button
aria-disabled="false"
aria-label="Close"
class="pf-v5-c-button pf-m-plain pf-v5-c-wizard__close"
data-ouia-component-id="OUIA-Generated-Button-plain-2"
data-ouia-component-type="PF4/Button"
data-ouia-safe="true"
type="button"
<div
class="pf-v5-c-wizard__close"
>
<svg
aria-hidden="true"
class="pf-v5-svg"
fill="currentColor"
role="img"
viewBox="0 0 352 512"
<button
aria-disabled="false"
aria-label="Close"
class="pf-v5-c-button pf-m-plain"
data-ouia-component-id="OUIA-Generated-Button-plain-2"
data-ouia-component-type="PF4/Button"
data-ouia-safe="true"
type="button"
>
<path
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
/>
</svg>
</button>
<h2
aria-label="Wizard title"
class="pf-v5-c-title pf-m-3xl pf-v5-c-wizard__title"
data-ouia-component-id="OUIA-Generated-Title-2"
data-ouia-component-type="PF4/Title"
data-ouia-safe="true"
id="pf-wizard-title-1"
<svg
aria-hidden="true"
class="pf-v5-svg"
fill="currentColor"
role="img"
viewBox="0 0 352 512"
>
<path
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
/>
</svg>
</button>
</div>
<div
class="pf-v5-c-wizard__title"
>
Wizard title
</h2>
<h2
class="pf-v5-c-wizard__title-text"
id="pf-wizard-title-1"
>
Wizard title
</h2>
</div>
<p
class="pf-v5-c-wizard__description"
id="pf-wizard-description-1"
Expand Down Expand Up @@ -277,37 +281,41 @@ exports[`Wizard Wizard should match snapshot 1`] = `
<div
class="pf-v5-c-wizard__header"
>
<button
aria-disabled="false"
aria-label="Close"
class="pf-v5-c-button pf-m-plain pf-v5-c-wizard__close"
data-ouia-component-id="OUIA-Generated-Button-plain-1"
data-ouia-component-type="PF4/Button"
data-ouia-safe="true"
type="button"
<div
class="pf-v5-c-wizard__close"
>
<svg
aria-hidden="true"
class="pf-v5-svg"
fill="currentColor"
role="img"
viewBox="0 0 352 512"
<button
aria-disabled="false"
aria-label="Close"
class="pf-v5-c-button pf-m-plain"
data-ouia-component-id="OUIA-Generated-Button-plain-1"
data-ouia-component-type="PF4/Button"
data-ouia-safe="true"
type="button"
>
<path
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
/>
</svg>
</button>
<h2
aria-label="Wizard title"
class="pf-v5-c-title pf-m-3xl pf-v5-c-wizard__title"
data-ouia-component-id="OUIA-Generated-Title-1"
data-ouia-component-type="PF4/Title"
data-ouia-safe="true"
id="pf-wizard-title-0"
<svg
aria-hidden="true"
class="pf-v5-svg"
fill="currentColor"
role="img"
viewBox="0 0 352 512"
>
<path
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
/>
</svg>
</button>
</div>
<div
class="pf-v5-c-wizard__title"
>
Wizard title
</h2>
<h2
class="pf-v5-c-wizard__title-text"
id="pf-wizard-title-0"
>
Wizard title
</h2>
</div>
<p
class="pf-v5-c-wizard__description"
id="pf-wizard-description-0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Wizard Demo Test', () => {
it('Verify wizard in modal sends focus to the new content', () => {
cy.get('#launchWiz').click();
cy.get('#modalWizId.pf-v5-c-wizard').should('exist');
cy.focused().should('have.class', 'pf-v5-c-wizard__close');
cy.focused().should('have.class', 'pf-v5-c-button');
cy.focused().click();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Wizard Deprecated Demo Test', () => {
it('Verify wizard in modal sends focus to the new content', () => {
cy.get('#launchWiz').click();
cy.get('#modalWizId.pf-v5-c-wizard').should('exist');
cy.focused().should('have.class', 'pf-v5-c-wizard__close');
cy.focused().should('have.class', 'pf-v5-c-button');
cy.focused().click();
});

Expand All @@ -38,6 +38,6 @@ describe('Wizard Deprecated Demo Test', () => {
cy.get('#wizard-correct-role .pf-v5-c-wizard__main button').click();
// Within a modal, wizard body uses the <main> element and should not have a role applied
cy.get('#wizard-correct-role .pf-v5-c-wizard__main').should('not.have.attr', 'role');
cy.get('#wizard-correct-role .pf-v5-c-wizard__close').click();
cy.get('#wizard-correct-role .pf-v5-c-wizard__close button').click();
});
});