A11Y: uses role=button and supports ariaPressed for tapTile (#11827)

This commit is contained in:
Joffrey JAFFEUX 2021-01-25 11:31:52 +01:00 committed by GitHub
parent 8edd2b38cb
commit bed011feef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,26 @@
import { reads } from "@ember/object/computed";
import Component from "@ember/component";
import { propertyEqual } from "discourse/lib/computed";
export default Component.extend({
init() {
this._super(...arguments);
this.set("elementId", `tap_tile_${this.tileId}`);
},
classNames: ["tap-tile"],
classNameBindings: ["active"],
attributeBindings: ["role", "ariaPressed", "tabIndex"],
role: "button",
tabIndex: 0,
ariaPressed: reads("active"),
click() {
this.onChange(this.tileId);
},