-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
35 changed files
with
632 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
|
||
/** | ||
* A controller for managing ARIA attributes for a field element: | ||
* either the component itself or slotted `<input>` element. | ||
*/ | ||
export class FieldAriaController { | ||
constructor(host: HTMLElement); | ||
|
||
/** | ||
* The controller host element. | ||
*/ | ||
host: HTMLElement; | ||
|
||
/** | ||
* Sets a target element to which ARIA attributes are added. | ||
*/ | ||
setTarget(target: HTMLElement): void; | ||
|
||
/** | ||
* Toggles the `aria-required` attribute on the target element | ||
* if the target is the host component (e.g. a field group). | ||
* Otherwise, it does nothing. | ||
*/ | ||
setRequired(required: boolean): void; | ||
|
||
/** | ||
* Links the target element with a slotted label element | ||
* via the target's attribute `aria-labelledby`. | ||
* | ||
* To unlink the previous slotted label element, pass `null` as `labelId`. | ||
*/ | ||
setLabelId(labelId: string | null): void; | ||
|
||
/** | ||
* Links the target element with a slotted error element via the target's attribute: | ||
* - `aria-labelledby` if the target is the host component (e.g a field group). | ||
* - `aria-describedby` otherwise. | ||
* | ||
* To unlink the previous slotted error element, pass `null` as `errorId`. | ||
*/ | ||
setErrorId(errorId: string | null): void; | ||
|
||
/** | ||
* Links the target element with a slotted helper element via the target's attribute: | ||
* - `aria-labelledby` if the target is the host component (e.g a field group). | ||
* - `aria-describedby` otherwise. | ||
* | ||
* To unlink the previous slotted helper element, pass `null` as `helperId`. | ||
*/ | ||
setHelperId(helperId: string | null): void; | ||
} |
Oops, something went wrong.