From 09c624a739cbeda0dab35878a5053b75bdc86e35 Mon Sep 17 00:00:00 2001 From: Stepan Kuntso Date: Mon, 16 Nov 2026 21:06:26 +0100 Subject: [PATCH] Set aria-posinset and aria-setsize on grid rows With smart rendering only the rows in view are in the DOM, and onBeforeTaskDisplay can hide some of them, so a screen reader that counts the rows in the DOM reports a wrong position and size. Each row now states its position among the displayed siblings. --- src/core/ui/wai_aria.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core/ui/wai_aria.js b/src/core/ui/wai_aria.js index 7164e97..61a8aab 100644 --- a/src/core/ui/wai_aria.js +++ b/src/core/ui/wai_aria.js @@ -77,6 +77,24 @@ export default function(gantt){ if(gantt.hasChild(task.id)){ div.setAttribute("aria-expanded", task.$open ? "true" : "false"); } + + // with smart rendering or a filter only a part of the rows is in the DOM, + // so the position among the displayed siblings is given explicitly + var siblings = gantt.getSiblings(task.id); + var position = 0; + var size = 0; + for(var i = 0; i < siblings.length; i++){ + if(gantt.getGlobalTaskIndex(siblings[i]) > -1){ + size++; + if(siblings[i] == task.id){ + position = size; + } + } + } + if(position){ + div.setAttribute("aria-posinset", position); + div.setAttribute("aria-setsize", size); + } }, linkAttr: function(link, div){