Skip to content

Commit

Permalink
add warnings for deprecated ARIA attributes (#1560)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevefaulkner authored Mar 5, 2023
1 parent b4849c0 commit e61fbeb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
13 changes: 13 additions & 0 deletions schema/.drivers/legacy.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,19 @@ datatypes w = "http://whattf.org/datatype-draft"
}
html.attrs &= html.attrs.version?

## Obsolete ARIA attributes

aria.state.grabbed =
attribute aria-grabbed {
string
}
aria.state.dropeffect =
attribute aria-dropeffect {
string
}
aria.global &= aria.state.grabbed?
aria.global &= aria.state.dropeffect?

## Obsolete style attributes

## align attribute
Expand Down
17 changes: 0 additions & 17 deletions schema/html5/aria.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ aria.global =
& aria.prop.describedby?
& aria.prop.details?
& aria.state.disabled?
& aria.state.dropeffect?
& aria.prop.errormessage?
& aria.prop.flowto?
& aria.state.grabbed?
& aria.prop.haspopup?
& aria.state.hidden?
& aria.state.invalid?
Expand Down Expand Up @@ -288,13 +286,6 @@ common.attrs.aria.implicit.navigation |= common.attrs.aria.implicit.landmark
| string "false" #default
}

## dropeffect
aria.state.dropeffect =
attribute aria-dropeffect
{
list { ("copy" | "execute" | "link" | "move" | "none" | "popup") + }
}

## expanded
aria.state.expanded =
attribute aria-expanded
Expand All @@ -303,14 +294,6 @@ common.attrs.aria.implicit.navigation |= common.attrs.aria.implicit.landmark
| string "undefined" #default
}

## grabbed
aria.state.grabbed =
attribute aria-grabbed
{ string "true"
| string "false"
| string "undefined" #default
}

## hidden
aria.state.hidden =
attribute aria-hidden
Expand Down
10 changes: 10 additions & 0 deletions src/nu/validator/checker/ConformingButObsoleteWarner.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public class ConformingButObsoleteWarner extends Checker {
public void startElement(String uri, String localName, String name,
Attributes atts) throws SAXException {
if ("http://www.w3.org/1999/xhtml" == uri) {
int len = atts.getLength();
for (int i = 0; i < len; i++) {
String attributeName = atts.getLocalName(i);
if ("aria-dropeffect".equals(attributeName)
|| "aria-grabbed".equals(attributeName)) {
warn("The \u201C" + attributeName + "\u201D attribute is"
+ " deprecated and should not be used. Support for"
+ " it is poor and is unlikely to improve.");
}
}
if ("img" == localName) {
if (atts.getIndex("", "border") > -1) {
warn("The \u201Cborder\u201D attribute is obsolete."
Expand Down
2 changes: 1 addition & 1 deletion tests
Submodule tests updated 22 files
+0 −11 html-aria/presentation-role/499-novalid.html
+0 −11 html-aria/presentation-role/501-novalid.html
+0 −15 html-aria/presentation-role/517.html
+0 −15 html-aria/presentation-role/519.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-dropeffect-copy.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-dropeffect-execute.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-dropeffect-link.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-dropeffect-move.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-dropeffect-none.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-dropeffect-popup.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-grabbed-false.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-grabbed-true.html
+0 −12 html-aria/properties-global-norole/properties-global-norole-aria-grabbed-undefined.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-dropeffect-copy.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-dropeffect-execute.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-dropeffect-link.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-dropeffect-move.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-dropeffect-none.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-dropeffect-popup.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-grabbed-false.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-grabbed-true.html
+0 −12 html-aria/roles-properties-global/roles-properties-global-main-aria-grabbed-undefined.html

0 comments on commit e61fbeb

Please sign in to comment.