Skip to content

Commit e61fbeb

Browse files
add warnings for deprecated ARIA attributes (#1560)
1 parent b4849c0 commit e61fbeb

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

schema/.drivers/legacy.rnc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,19 @@ datatypes w = "http://whattf.org/datatype-draft"
576576
}
577577
html.attrs &= html.attrs.version?
578578

579+
## Obsolete ARIA attributes
580+
581+
aria.state.grabbed =
582+
attribute aria-grabbed {
583+
string
584+
}
585+
aria.state.dropeffect =
586+
attribute aria-dropeffect {
587+
string
588+
}
589+
aria.global &= aria.state.grabbed?
590+
aria.global &= aria.state.dropeffect?
591+
579592
## Obsolete style attributes
580593

581594
## align attribute

schema/html5/aria.rnc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ aria.global =
1717
& aria.prop.describedby?
1818
& aria.prop.details?
1919
& aria.state.disabled?
20-
& aria.state.dropeffect?
2120
& aria.prop.errormessage?
2221
& aria.prop.flowto?
23-
& aria.state.grabbed?
2422
& aria.prop.haspopup?
2523
& aria.state.hidden?
2624
& aria.state.invalid?
@@ -288,13 +286,6 @@ common.attrs.aria.implicit.navigation |= common.attrs.aria.implicit.landmark
288286
| string "false" #default
289287
}
290288

291-
## dropeffect
292-
aria.state.dropeffect =
293-
attribute aria-dropeffect
294-
{
295-
list { ("copy" | "execute" | "link" | "move" | "none" | "popup") + }
296-
}
297-
298289
## expanded
299290
aria.state.expanded =
300291
attribute aria-expanded
@@ -303,14 +294,6 @@ common.attrs.aria.implicit.navigation |= common.attrs.aria.implicit.landmark
303294
| string "undefined" #default
304295
}
305296

306-
## grabbed
307-
aria.state.grabbed =
308-
attribute aria-grabbed
309-
{ string "true"
310-
| string "false"
311-
| string "undefined" #default
312-
}
313-
314297
## hidden
315298
aria.state.hidden =
316299
attribute aria-hidden

src/nu/validator/checker/ConformingButObsoleteWarner.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ public class ConformingButObsoleteWarner extends Checker {
3535
public void startElement(String uri, String localName, String name,
3636
Attributes atts) throws SAXException {
3737
if ("http://www.w3.org/1999/xhtml" == uri) {
38+
int len = atts.getLength();
39+
for (int i = 0; i < len; i++) {
40+
String attributeName = atts.getLocalName(i);
41+
if ("aria-dropeffect".equals(attributeName)
42+
|| "aria-grabbed".equals(attributeName)) {
43+
warn("The \u201C" + attributeName + "\u201D attribute is"
44+
+ " deprecated and should not be used. Support for"
45+
+ " it is poor and is unlikely to improve.");
46+
}
47+
}
3848
if ("img" == localName) {
3949
if (atts.getIndex("", "border") > -1) {
4050
warn("The \u201Cborder\u201D attribute is obsolete."

tests

Submodule tests updated 22 files

0 commit comments

Comments
 (0)