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

fix(aom): consolidating the aria dom property names #192

Merged
merged 2 commits into from
Mar 30, 2018
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
23 changes: 16 additions & 7 deletions packages/lwc-engine/src/framework/__tests__/def.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ describe('def', () => {
accessKey: null,
ariaActiveDescendant: null,
ariaAtomic: null,
ariaAutocomplete: null,
ariaAutoComplete: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casing was off!

ariaBusy: null,
ariaChecked: null,
ariaControls: null,
ariaCurrent: null,
ariaDescribedBy: null,
ariaDisabled: null,
ariaDragged: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-grabbed, this seems like a typo in the first place.
and aria-dropeffect are deprecated by spec.

ariaDropEffect: null,
ariaExpanded: null,
ariaFlowTo: null,
ariaHasPopUp: null,
Expand All @@ -98,12 +96,12 @@ describe('def', () => {
ariaLevel: null,
ariaLive: null,
ariaMultiSelectable: null,
ariaMultiline: null,
ariaMultiLine: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casing was off!

ariaOrientation: null,
ariaOwns: null,
ariaPosInSet: null,
ariaPressed: null,
ariaReadonly: null,
ariaReadOnly: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casing was off!

ariaRelevant: null,
ariaRequired: null,
ariaSelected: null,
Expand All @@ -113,6 +111,17 @@ describe('def', () => {
ariaValueMin: null,
ariaValueNow: null,
ariaValueText: null,
ariaColCount: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these were missing.

ariaColIndex: null,
ariaDetails: null,
ariaErrorMessage: null,
ariaKeyShortcuts: null,
ariaModal: null,
ariaPlaceholder: null,
ariaRoleDescription: null,
ariaRowCount: null,
ariaRowIndex: null,
ariaRowSpan: null,
dir: null,
draggable: null,
hidden: null,
Expand All @@ -124,7 +133,7 @@ describe('def', () => {
});
});

it('should provide default html props', () => {
it('should provide definition for each individual html prop', () => {
function foo() {}
class MyComponent extends Element {}
const { props } = target.getComponentDef(MyComponent);
Expand All @@ -140,7 +149,7 @@ describe('def', () => {
attr: 'role',
});
// aria exception
expect(props.ariaAutocomplete).toEqual({
expect(props.ariaAutoComplete).toEqual({
config: 3,
type: 'any',
attr: 'aria-autocomplete',
Expand Down
19 changes: 14 additions & 5 deletions packages/lwc-engine/src/framework/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function attemptAriaAttributeFallback(vm: VM, attrName: string) {
// respective default value.
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques
export const GlobalAOMProperties: Record<string, any> = {
ariaAutocomplete: null,
ariaAutoComplete: null,
ariaChecked: null,
ariaCurrent: null,
ariaDisabled: null,
Expand All @@ -144,11 +144,11 @@ export const GlobalAOMProperties: Record<string, any> = {
ariaInvalid: null,
ariaLabel: null,
ariaLevel: null,
ariaMultiline: null,
ariaMultiLine: null,
ariaMultiSelectable: null,
ariaOrientation: null,
ariaPressed: null,
ariaReadonly: null,
ariaReadOnly: null,
ariaRequired: null,
ariaSelected: null,
ariaSort: null,
Expand All @@ -160,8 +160,6 @@ export const GlobalAOMProperties: Record<string, any> = {
ariaRelevant: null,
ariaAtomic: null,
ariaBusy: null,
ariaDropEffect: null,
ariaDragged: null,
ariaActiveDescendant: null,
ariaControls: null,
ariaDescribedBy: null,
Expand All @@ -170,6 +168,17 @@ export const GlobalAOMProperties: Record<string, any> = {
ariaOwns: null,
ariaPosInSet: null,
ariaSetSize: null,
ariaColCount: null,
ariaColIndex: null,
ariaDetails: null,
ariaErrorMessage: null,
ariaKeyShortcuts: null,
ariaModal: null,
ariaPlaceholder: null,
ariaRoleDescription: null,
ariaRowCount: null,
ariaRowIndex: null,
ariaRowSpan: null,
role: null,
};

Expand Down
20 changes: 15 additions & 5 deletions packages/lwc-template-compiler/src/parser/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const ATTRS_PROPS_TRANFORMS: { [name: string]: string } = {
'for': 'htmlFor',

// Aria
'aria-autocomplete': 'ariaAutocomplete',
'aria-autocomplete': 'ariaAutoComplete',
'aria-checked': 'ariaChecked',
'aria-current': 'ariaCurrent',
'aria-disabled': 'ariaDisabled',
Expand All @@ -80,11 +80,11 @@ export const ATTRS_PROPS_TRANFORMS: { [name: string]: string } = {
'aria-invalid': 'ariaInvalid',
'aria-label': 'ariaLabel',
'aria-level': 'ariaLevel',
'aria-multiline': 'ariaMultiline',
'aria-multiline': 'ariaMultiLine',
'aria-multiselectable': 'ariaMultiSelectable',
'aria-orientation': 'ariaOrientation',
'aria-pressed': 'ariaPressed',
'aria-readonly': 'ariaReadonly',
'aria-readonly': 'ariaReadOnly',
'aria-required': 'ariaRequired',
'aria-selected': 'ariaSelected',
'aria-sort': 'ariaSort',
Expand All @@ -96,8 +96,6 @@ export const ATTRS_PROPS_TRANFORMS: { [name: string]: string } = {
'aria-relevant': 'ariaRelevant',
'aria-atomic': 'ariaAtomic',
'aria-busy': 'ariaBusy',
'aria-dropeffect': 'ariaDropEffect',
'aria-dragged': 'ariaDragged',
'aria-activedescendant': 'ariaActiveDescendant',
'aria-controls': 'ariaControls',
'aria-describedby': 'ariaDescribedBy',
Expand All @@ -106,6 +104,18 @@ export const ATTRS_PROPS_TRANFORMS: { [name: string]: string } = {
'aria-owns': 'ariaOwns',
'aria-posinset': 'ariaPosInSet',
'aria-setsize': 'ariaSetSize',

'aria-colcount': 'ariaColCount',
'aria-colindex': 'ariaColIndex',
'aria-details': 'ariaDetails',
'aria-errormessage': 'ariaErrorMessage',
'aria-keyshortcuts': 'ariaKeyShortcuts',
'aria-modal': 'ariaModal',
'aria-placeholder': 'ariaPlaceholder',
'aria-roledescription': 'ariaRoleDescription',
'aria-rowcount': 'ariaRowCount',
'aria-rowindex': 'ariaRowIndex',
'aria-rowspan': 'ariaRowSpan',
};

export const HTML_TAG_BLACKLIST: { [tagname: string]: boolean } = {
Expand Down