Skip to content

Commit 3900ead

Browse files
authored
Wrap pending in button (#5595)
Remove pass through for aria-hidden on progress. Wrap progress in a hidden div for pending
1 parent e6e7905 commit 3900ead

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

packages/@adobe/spectrum-css-temp/components/button/index.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ governing permissions and limitations under the License.
161161
left: 50%;
162162
top: 50%;
163163
transform: translate(-50%, -50%);
164+
display: flex;
165+
align-items: center;
164166
}
165167

166168
&.spectrum-Button--pending {

packages/@react-aria/progress/src/useProgressBar.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export interface ProgressBarAria {
2323
labelProps: DOMAttributes
2424
}
2525

26-
const allowedAttributes = new Set(['aria-hidden']);
27-
2826
/**
2927
* Provides the accessibility implementation for a progress bar component.
3028
* Progress bars show either determinate or indeterminate progress of an operation
@@ -42,7 +40,7 @@ export function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {
4240
}
4341
} = props;
4442

45-
let domProps = filterDOMProps(props, {labelable: true, propNames: allowedAttributes});
43+
let domProps = filterDOMProps(props, {labelable: true});
4644
let {labelProps, fieldProps} = useLabel({
4745
...props,
4846
// Progress bar is not an HTML input element so it

packages/@react-spectrum/button/src/Button.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,18 @@ function Button<T extends ElementType = 'button'>(props: SpectrumButtonProps<T>,
156156
{typeof children === 'string'
157157
? <Text>{children}</Text>
158158
: children}
159-
{isPending && <ProgressCircle
160-
aria-hidden="true"
161-
aria-label={isPendingAriaLiveLabel}
162-
isIndeterminate
163-
size="S"
164-
UNSAFE_className={classNames(styles, 'spectrum-Button-circleLoader')}
165-
UNSAFE_style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}
166-
staticColor={staticColor} />
167-
}
159+
{isPending && (
160+
<div
161+
aria-hidden="true"
162+
style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}
163+
className={classNames(styles, 'spectrum-Button-circleLoader')}>
164+
<ProgressCircle
165+
aria-label={isPendingAriaLiveLabel}
166+
isIndeterminate
167+
size="S"
168+
staticColor={staticColor} />
169+
</div>
170+
)}
168171
{isPending &&
169172
<>
170173
<div aria-live={isFocused ? ariaLive : 'off'}>

packages/@react-spectrum/progress/test/ProgressCircle.test.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,4 @@ describe('ProgressCircle', function () {
160160
let progressBar = getByTestId('test');
161161
expect(progressBar).toBeInTheDocument();
162162
});
163-
164-
it('supports aria-hidden', function () {
165-
let {getByRole} = render(<ProgressCircle value={25} aria-label="Progress" aria-hidden="true" />);
166-
let progressBar = getByRole('progressbar', {hidden: true});
167-
expect(progressBar).toBeInTheDocument();
168-
expect(progressBar).toHaveAttribute('aria-hidden', 'true');
169-
});
170163
});

0 commit comments

Comments
 (0)