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 failing tests in the main branch #941

Merged
merged 3 commits into from
Aug 11, 2023
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
1 change: 0 additions & 1 deletion __mocks__/genInteractives.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const interactiveElementsMap = {
menuitem: [],
option: [],
select: [],
summary: [],
// Whereas ARIA makes a distinction between cell and gridcell, the AXObject
// treats them both as CellRole and since gridcell is interactive, we consider
// cell interactive as well.
Expand Down
8 changes: 4 additions & 4 deletions __tests__/src/rules/mouse-events-have-key-events-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ const ruleTester = new RuleTester();

const mouseOverError = {
message: 'onMouseOver must be accompanied by onFocus for accessibility.',
type: 'JSXOpeningElement',
type: 'JSXAttribute',
};
const pointerEnterError = {
message: 'onPointerEnter must be accompanied by onFocus for accessibility.',
type: 'JSXOpeningElement',
type: 'JSXAttribute',
};
const mouseOutError = {
message: 'onMouseOut must be accompanied by onBlur for accessibility.',
type: 'JSXOpeningElement',
type: 'JSXAttribute',
};
const pointerLeaveError = {
message: 'onPointerLeave must be accompanied by onBlur for accessibility.',
type: 'JSXOpeningElement',
type: 'JSXAttribute',
};

ruleTester.run('mouse-events-have-key-events', rule, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ const neverValid = [
{ code: '<menuitem role="listitem" />;', errors: [expectedError] },
{ code: '<option className="foo" role="listitem" />', errors: [expectedError] },
{ code: '<select className="foo" role="listitem" />', errors: [expectedError] },
{ code: '<summary role="listitem" />;', errors: [expectedError] },
{ code: '<textarea className="foo" role="listitem" />', errors: [expectedError] },
{ code: '<tr role="listitem" />;', errors: [expectedError] },
/* Custom elements */
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/rules/no-static-element-interactions-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ const alwaysValid = [
{ code: '<ruby onClick={() => {}} />;' },
{ code: '<section onClick={() => {}} aria-label="Aa" />;' },
{ code: '<section onClick={() => {}} aria-labelledby="js_1" />;' },
{ code: '<summary onClick={() => {}} />;' },
{ code: '<table onClick={() => {}} />;' },
{ code: '<tbody onClick={() => {}} />;' },
{ code: '<tfoot onClick={() => {}} />;' },
Expand Down Expand Up @@ -340,6 +339,7 @@ const neverValid = [
{ code: '<style onClick={() => {}} />;', errors: [expectedError] },
{ code: '<sub onClick={() => {}} />;', errors: [expectedError] },
{ code: '<sup onClick={() => {}} />;', errors: [expectedError] },
{ code: '<summary onClick={() => {}} />;', errors: [expectedError] },
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this test adjustment is right, this may be an issue in axobject-query: A11yance/axobject-query#319

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dummdidumm ya, I think you're right. This is a tricky one. More details here: https://html.spec.whatwg.org/multipage/interactive-elements.html#the-summary-element

Given that we need to know the rendered output to make a determination about this element's role and behavior, the best course of action for a static linter is to be permissive of either state - an interactive element or a generic (static) element. I'll get this updated when I do a proper update of aria-query for ARIA 1.3.

Copy link
Collaborator Author

@jessebeach jessebeach Aug 13, 2023

Choose a reason for hiding this comment

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

@dummdidumm #656 to tracks this.

{ code: '<title onClick={() => {}} />;', errors: [expectedError] },
{ code: '<track onClick={() => {}} />;', errors: [expectedError] },
{ code: '<tt onClick={() => {}} />;', errors: [expectedError] },
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"expect": "^24.9.0",
"flow-bin": "^0.147.0",
"in-publish": "^2.0.1",
"jackspeak": "=2.1.1",
"jest": "^24.9.0",
"jscodeshift": "^0.7.1",
"minimist": "^1.2.7",
Expand All @@ -73,11 +74,11 @@
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.20.7",
"aria-query": "^5.1.3",
"aria-query": "=5.1.3",
"array-includes": "^3.1.6",
"array.prototype.flatmap": "^1.3.1",
"ast-types-flow": "^0.0.7",
"axe-core": "^4.6.2",
"axe-core": "=4.7.0",
"axobject-query": "^3.1.1",
"damerau-levenshtein": "^1.0.8",
"emoji-regex": "^9.2.2",
Expand Down
4 changes: 2 additions & 2 deletions src/rules/mouse-events-have-key-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default ({

if (hasOnFocus === false || onFocusValue === null || onFocusValue === undefined) {
context.report({
node,
node: getProp(attributes, firstHoverInHandlerWithValue),
message: `${firstHoverInHandlerWithValue} must be accompanied by onFocus for accessibility.`,
});
}
Expand All @@ -86,7 +86,7 @@ export default ({

if (hasOnBlur === false || onBlurValue === null || onBlurValue === undefined) {
context.report({
node,
node: getProp(attributes, firstHoverOutHandlerWithValue),
message: `${firstHoverOutHandlerWithValue} must be accompanied by onBlur for accessibility.`,
});
}
Expand Down
Loading