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(ExportModal): screen reader identifies hidden controls #6079

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
189 changes: 98 additions & 91 deletions packages/ibm-products/src/components/ExportModal/ExportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
RadioButton,
RadioButtonGroup,
TextInput,
unstable_FeatureFlags as FeatureFlags,
} from '@carbon/react';
import { CheckmarkFilled, ErrorFilled } from '@carbon/react/icons';
import React, {
Expand Down Expand Up @@ -254,101 +255,107 @@ export let ExportModal = forwardRef(
};

return renderPortalUse(
<ComposedModal
{...rest}
className={cx(blockClass, className)}
aria-label={title}
size="sm"
preventCloseOnClickOutside
{...{ open, ref, onClose, ...getDevtoolsProps(componentName) }}
<FeatureFlags
flags={{
'enable-experimental-focus-wrap-without-sentinels': true,
}}
>
<ModalHeader
className={`${blockClass}__header`}
closeModal={onClose}
title={title}
/>
<ModalBody className={`${blockClass}__body-container`}>
{!submitted && (
<>
{body && <p className={`${blockClass}__body`}>{body}</p>}
{preformattedExtensions.length ? (
<FormGroup legendText={preformattedExtensionsLabel}>
<RadioButtonGroup
orientation="vertical"
onChange={onExtensionChangeHandler}
valueSelected={extension}
name="extensions"
>
{preformattedExtensions.map((o) => (
<RadioButton
key={o.extension}
id={o.extension}
value={o.extension}
labelText={`${o.extension} (${o.description})`}
data-modal-primary-focus
/>
))}
</RadioButtonGroup>
</FormGroup>
) : (
<div className={`${blockClass}__input-container`}>
{inputType === 'text' ? (
<TextInput {...commonInputProps} />
) : (
<PasswordInput
{...commonInputProps}
showPasswordLabel={showPasswordLabel}
hidePasswordLabel={hidePasswordLabel}
tooltipPosition="left"
/>
)}
</div>
)}
</>
)}
<div className={`${blockClass}__messaging`}>
{loading && (
<>
<Loading small withOverlay={false} />
<p>{loadingMessage}</p>
</>
)}
{successful && (
<>
<CheckmarkFilled
size={16}
className={`${blockClass}__checkmark-icon`}
/>
<p>{successMessage}</p>
</>
)}
{error && (
<ComposedModal
{...rest}
className={cx(blockClass, className)}
aria-label={title}
size="sm"
preventCloseOnClickOutside
{...{ open, ref, onClose, ...getDevtoolsProps(componentName) }}
>
<ModalHeader
className={`${blockClass}__header`}
closeModal={onClose}
title={title}
/>
<ModalBody className={`${blockClass}__body-container`}>
{!submitted && (
<>
<ErrorFilled
size={16}
className={`${blockClass}__error-icon`}
/>
<p>{errorMessage}</p>
{body && <p className={`${blockClass}__body`}>{body}</p>}
{preformattedExtensions.length ? (
<FormGroup legendText={preformattedExtensionsLabel}>
<RadioButtonGroup
orientation="vertical"
onChange={onExtensionChangeHandler}
valueSelected={extension}
name="extensions"
>
{preformattedExtensions.map((o) => (
<RadioButton
key={o.extension}
id={o.extension}
value={o.extension}
labelText={`${o.extension} (${o.description})`}
data-modal-primary-focus
/>
))}
</RadioButtonGroup>
</FormGroup>
) : (
<div className={`${blockClass}__input-container`}>
{inputType === 'text' ? (
<TextInput {...commonInputProps} />
) : (
<PasswordInput
{...commonInputProps}
showPasswordLabel={showPasswordLabel}
hidePasswordLabel={hidePasswordLabel}
tooltipPosition="left"
/>
)}
</div>
)}
</>
)}
</div>
</ModalBody>
{!submitted && (
<ModalFooter className={`${blockClass}__footer`}>
<Button type="button" kind="secondary" onClick={onClose}>
{secondaryButtonText}
</Button>
<Button
type="submit"
kind="primary"
onClick={onSubmitHandler}
disabled={primaryButtonDisabled}
>
{primaryButtonText}
</Button>
</ModalFooter>
)}
</ComposedModal>
<div className={`${blockClass}__messaging`}>
{loading && (
<>
<Loading small withOverlay={false} />
<p>{loadingMessage}</p>
</>
)}
{successful && (
<>
<CheckmarkFilled
size={16}
className={`${blockClass}__checkmark-icon`}
/>
<p>{successMessage}</p>
</>
)}
{error && (
<>
<ErrorFilled
size={16}
className={`${blockClass}__error-icon`}
/>
<p>{errorMessage}</p>
</>
)}
</div>
</ModalBody>
{!submitted && (
<ModalFooter className={`${blockClass}__footer`}>
<Button type="button" kind="secondary" onClick={onClose}>
{secondaryButtonText}
</Button>
<Button
type="submit"
kind="primary"
onClick={onSubmitHandler}
disabled={primaryButtonDisabled}
>
{primaryButtonText}
</Button>
</ModalFooter>
)}
</ComposedModal>
</FeatureFlags>
);
}
);
Expand Down
Loading