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

Use React's AriaAttributes type directly rather than recreating #4941

Merged
merged 8 commits into from Jan 13, 2022
17 changes: 7 additions & 10 deletions packages/react-select/src/Select.tsx
@@ -1,4 +1,5 @@
import React, {
AriaAttributes,
Component,
FocusEventHandler,
FormEventHandler,
Expand All @@ -13,11 +14,7 @@ import LiveRegion from './components/LiveRegion';

import { createFilter, FilterOptionOption } from './filters';
import { DummyInput, ScrollManager } from './internal/index';
import {
AriaLive,
AriaLiveMessages,
AriaSelection,
} from './accessibility/index';
import { AriaLiveMessages, AriaSelection } from './accessibility/index';

import {
classNames,
Expand Down Expand Up @@ -74,15 +71,15 @@ export interface Props<
Group extends GroupBase<Option>
> {
/** HTML ID of an element containing an error message related to the input**/
'aria-errormessage'?: string;
'aria-errormessage'?: AriaAttributes['aria-errormessage'];
prichey marked this conversation as resolved.
Show resolved Hide resolved
/** Indicate if the value entered in the field is invalid **/
'aria-invalid'?: boolean;
'aria-invalid'?: AriaAttributes['aria-invalid'];
/** Aria label (for assistive tech) */
'aria-label'?: string;
'aria-label'?: AriaAttributes['aria-label'];
/** HTML ID of an element that should be used as the label (for assistive tech) */
'aria-labelledby'?: string;
'aria-labelledby'?: AriaAttributes['aria-labelledby'];
/** Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive */
'aria-live'?: AriaLive;
'aria-live'?: AriaAttributes['aria-live'];
/** Customize the messages used by the aria-live component */
ariaLiveMessages?: AriaLiveMessages<Option, IsMulti, Group>;
/** Focus the control when it is mounted */
Expand Down
2 changes: 0 additions & 2 deletions packages/react-select/src/accessibility/index.ts
Expand Up @@ -11,8 +11,6 @@ export type OptionContext = 'menu' | 'value';

export type GuidanceContext = 'menu' | 'input' | 'value';

export type AriaLive = 'polite' | 'off' | 'assertive';

export type AriaSelection<Option, IsMulti extends boolean> =
| InitialInputFocusedActionMeta<Option, IsMulti>
| (ActionMeta<Option> & {
Expand Down
1 change: 0 additions & 1 deletion packages/react-select/src/index.ts
Expand Up @@ -46,7 +46,6 @@ export * from './types';
export type {
OptionContext,
GuidanceContext,
AriaLive,
AriaGuidanceProps,
AriaOnChangeProps,
AriaOnFilterProps,
Expand Down