Skip to content

chore(cdk/a11y): fix contrast spelling #19181

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

Merged
merged 3 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/cdk/a11y/aria-describer/aria-reference.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ describe('AriaReference', () => {
.toEqual(['reference_1']);
});

it('should retrieve ids that are deliminated by extra whitespace', () => {
it('should retrieve ids that are delimited by extra whitespace', () => {
testElement!.setAttribute('aria-describedby', 'reference_1 reference_2');
expect(getAriaReferenceIds(testElement!, 'aria-describedby'))
.toEqual(['reference_1', 'reference_2']);
});

/**
* Expects the equal array from getAriaReferenceIds and a space-deliminated list from
* Expects the equal array from getAriaReferenceIds and a space-delimited list from
* the actual element attribute. If ids is empty, assumes the element should not have any
* value
*/
Expand Down
10 changes: 5 additions & 5 deletions src/cdk/a11y/aria-describer/aria-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/

/** IDs are deliminated by an empty space, as per the spec. */
const ID_DELIMINATOR = ' ';
/** IDs are delimited by an empty space, as per the spec. */
const ID_DELIMITER = ' ';

/**
* Adds the given ID to the specified ARIA attribute on an element.
Expand All @@ -18,7 +18,7 @@ export function addAriaReferencedId(el: Element, attr: string, id: string) {
if (ids.some(existingId => existingId.trim() == id.trim())) { return; }
ids.push(id.trim());

el.setAttribute(attr, ids.join(ID_DELIMINATOR));
el.setAttribute(attr, ids.join(ID_DELIMITER));
}

/**
Expand All @@ -30,7 +30,7 @@ export function removeAriaReferencedId(el: Element, attr: string, id: string) {
const filteredIds = ids.filter(val => val != id.trim());

if (filteredIds.length) {
el.setAttribute(attr, filteredIds.join(ID_DELIMINATOR));
el.setAttribute(attr, filteredIds.join(ID_DELIMITER));
} else {
el.removeAttribute(attr);
}
Expand All @@ -41,6 +41,6 @@ export function removeAriaReferencedId(el: Element, attr: string, id: string) {
* Used for attributes such as aria-labelledby, aria-owns, etc.
*/
export function getAriaReferenceIds(el: Element, attr: string): string[] {
// Get string array of all individual ids (whitespace deliminated) in the attribute value
// Get string array of all individual ids (whitespace delimited) in the attribute value
return (el.getAttribute(attr) || '').match(/\S+/g) || [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const WHITE_ON_BLACK_CSS_CLASS = 'cdk-high-contrast-white-on-black';
export const HIGH_CONTRAST_MODE_ACTIVE_CSS_CLASS = 'cdk-high-contrast-active';

/**
* Service to determine whether the browser is currently in a high-constrast-mode environment.
* Service to determine whether the browser is currently in a high-contrast-mode environment.
*
* Microsoft Windows supports an accessibility feature called "High Contrast Mode". This mode
* changes the appearance of all applications, including web applications, to dramatically increase
Expand All @@ -46,7 +46,7 @@ export class HighContrastModeDetector {
this._document = document;
}

/** Gets the current high-constrast-mode for the page. */
/** Gets the current high-contrast-mode for the page. */
getHighContrastMode(): HighContrastMode {
if (!this._platform.isBrowser) {
return HighContrastMode.NONE;
Expand Down