From bed011feef23f7cc12fde9762fe76849a7c04479 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 25 Jan 2021 11:31:52 +0100 Subject: [PATCH] A11Y: uses role=button and supports ariaPressed for tapTile (#11827) --- .../discourse/app/components/tap-tile.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/assets/javascripts/discourse/app/components/tap-tile.js b/app/assets/javascripts/discourse/app/components/tap-tile.js index b384ff7d71..8671cc1ad2 100644 --- a/app/assets/javascripts/discourse/app/components/tap-tile.js +++ b/app/assets/javascripts/discourse/app/components/tap-tile.js @@ -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); },