Skip to content

Commit

Permalink
moiroe
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertCarreras committed Jan 16, 2025
1 parent 362844e commit b1c77a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
15 changes: 6 additions & 9 deletions docs/pages/web/spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import main from '../../examples/spinner/main';
import white from '../../examples/spinner/white';

export default function DocsPage({ generatedDocGen }: { generatedDocGen: DocGen }) {

return (
<Page title={generatedDocGen?.displayName}>
<PageHeader description={generatedDocGen?.description} name={generatedDocGen?.displayName}>
Expand Down Expand Up @@ -145,15 +144,17 @@ export default function DocsPage({ generatedDocGen }: { generatedDocGen: DocGen

<AccessibilitySection
description={`
Be sure to include \`accessibilityLabel\`. Labels should relate to the specific part of the product where Spinner is being used (e.g. "Loading homefeed" when used on the homefeed surface). Don't forget to localize the label!
Be sure to include \`accessibilityLabel\` if there's no \`label\`. \`accessibilityLabel\` should relate to the specific part of the product where Spinner is being used (e.g. "Loading homefeed" when used on the homefeed surface). Don't forget to localize the label!
The override order for labels: \`accessibilityLabel\` overrides \`label\`, \`label\` overrides default label from DefaultLabelProvider. DefaultLabelProvider is only accessible if there is not \`accessibilityLabel\` not \`label\`.
`}
name={generatedDocGen?.displayName}
/>

<LocalizationSection
code={localizationLabels}
name={generatedDocGen?.displayName}
notes={`Note that \`accessibilityLabel\` is optional as DefaultLabelProvider provides default strings. Use custom labels if they need to be more specific.`}
notes={`Note that \`accessibilityLabel\` is optional as DefaultLabelProvider provides default strings. Use custom labels if they need to be more specific. DefaultLabelProvider is override by \`label\`.`}
/>

<MainSection name="Variants">
Expand All @@ -173,17 +174,13 @@ export default function DocsPage({ generatedDocGen }: { generatedDocGen: DocGen
/>
<MainSection.Card
cardSize="lg"
sandpackExample={
<SandpackExample code={white} layout="column" name="Delay variant" />
}
sandpackExample={<SandpackExample code={white} layout="column" name="Delay variant" />}
title="White"
/>
</MainSection.Subsection>

<MainSection.Subsection
description={`
Spinner supports a label.
`}
description={`Spinner supports a label. If \`label\` is provided, \`accessibilityLabel\` is not needed. \`accessibilityLabel\` overrides "label" for assistive technologies. See the [Accessibility guidelines](#Accessibility) for more information`}
title="Label"
>
<MainSection.Card
Expand Down
4 changes: 2 additions & 2 deletions packages/gestalt/src/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function Spinner({

if (isInVRExperiment) {
return (
<VRSpinner
<VRSpinner
accessibilityLabel={accessibilityLabel}
color={color === 'subtle' ? 'default' : color} // 'subtle' maps to 'default' as it is not a VR color variant
delay={delay}
Expand All @@ -84,7 +84,7 @@ export default function Spinner({
<div className={classnames(styles.icon, { [styles.delay]: delay })}>
<InternalIcon
accessibilityDescribedby={label ? id : undefined}
accessibilityLabel={accessibilityLabel ?? accessibilityLabelDefault}
accessibilityLabel={accessibilityLabel ?? label ?? accessibilityLabelDefault}
// map non-classic colors to subtle
color={color === 'default' || color === 'subtle' ? color : 'subtle'}
icon="knoop"
Expand Down
2 changes: 1 addition & 1 deletion packages/gestalt/src/Spinner/VRSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function Spinner({
<Flex direction="column" gap={6}>
<SpinnerBody
accessibilityDescribedby={label ? id : undefined}
accessibilityLabel={accessibilityLabel ?? accessibilityLabelDefault}
accessibilityLabel={accessibilityLabel ?? label ?? accessibilityLabelDefault}
color={color}
delay={delay}
onExitAnimationEnd={unmountSpinner}
Expand Down

0 comments on commit b1c77a2

Please sign in to comment.