I faced the following issue:
I have a list UL
, each LI
in it has it's own remove button.
Using screen reader JAWS 18 if I click the first LI
and remove it, Jaws jumps to the THIRD element in a list. Sometimes after removing some other LI
it can jump directly to the end of the UL
.
Here is the simple example of my markup https://jsfiddle.net/dogusev/w1xLo7uv/
Who faced such a problem? And how was it solved?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<ul id="theList">
<li><span>1</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>2</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>3</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>4</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>5</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>6</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>7</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>8</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>9</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>10</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>11</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
<li><span>12</span> <ul> <li><button onclick="removeItem(this)">remove me</button></li> </ul> </li>
</ul>
<script>
var removeItem = function removeItem(el) {
var theList = document.getElementById('theList'),
liElement = el.parentElement.parentElement.parentElement;
theList.removeChild(liElement);
}
</script>
</body>
</html>
UPD: step by step:
Open page
Run JAWS
navigate with KEY DOWN to the first list item
Read content in it and move via KEY DOWN to the REMOVE BUTTON in this item
Click on REMOVE BUTTON
After list item removed navigate via KEY DOWN to the next list item
If we removed the first item, after navigation JAWS will be focused on the OLD third element, NOT ON THE OLD SECOND, or NEW FIRST ITEM, NOT ON THE NEW SECOND