Skip to content

Commit

Permalink
fix(820): move with attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
skippednote committed Jun 27, 2020
1 parent 60b1d96 commit aeda814
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
37 changes: 19 additions & 18 deletions src/compiler/compile/nodes/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,25 @@ export default class Element extends Node {
});
}

if (name === "onmouseover") {
if (this.attributes.find(i => i.name === 'onFocus')) {
component.warn(attribute, {
code: `a11y-mouse-events-have-key-events`,
message: `A11y: onMouseOver must be accompanied by onFocus for accessibility.`
});
}
}

if (name === "onmouseout") {
if (this.attributes.find(i => i.name === 'onBlur')) {
component.warn(attribute, {
code: `a11y-mouse-events-have-key-events`,
message: `A11y: onMouseOut must be accompanied by onBlur for accessibility.`
});
}
}


attribute_map.set(attribute.name, attribute);
});
}
Expand Down Expand Up @@ -507,24 +526,6 @@ export default class Element extends Node {
}
}

if (attribute_map.has('onMouseOver') || attribute_map.has('onMouseOut')) {
if (attribute_map.has('onMouseOver') && !attribute_map.has('onFocus')) {
component.warn(this, {
code: `a11y-mouse-events-have-key-events`,
message: `A11y: onMouseOver must be accompanied by onFocus for accessibility.`
});
}

if (attribute_map.has('onMouseOut') && attribute_map.has('onBlur')) {
component.warn(this, {
code: `a11y-mouse-events-have-key-events`,
message: `A11y: onMouseOut must be accompanied by onBlur for accessibility.`
});
}


}

if (a11y_no_onchange.has(this.name)) {
if (handlers_map.has('change') && !handlers_map.has('blur')) {
component.warn(this, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
{
"code": "a11y-mouse-events-have-key-events",
"end": {
"character": 36,
"column": 36,
"line": 1
"character": 106,
"column": 33,
"line": 3
},
"message": "A11y: onMouseOver must be accompanied by onFocus for accessibility.",
"pos": 0,
"pos": 78,
"start": {
"character": 0,
"column": 0,
"line": 1
"character": 78,
"column": 5,
"line": 3
}
},
{
"code": "a11y-mouse-events-have-key-events",
"end": {
"character": 194,
"column": 59,
"character": 167,
"column": 32,
"line": 4
},
"message": "A11y: onMouseOut must be accompanied by onBlur for accessibility.",
"pos": 135,
"pos": 140,
"start": {
"character": 135,
"column": 0,
"character": 140,
"column": 5,
"line": 4
}
}
Expand Down

0 comments on commit aeda814

Please sign in to comment.