Describe the bug
We get the following error tracked via Sentry:
can't access property "getAttribute", this.shadowRoot.activeElement is null
which is caused by that code:
_spaceCatcher: function (e) {
e.preventDefault();
if (this.shadowRoot != null) {
var nextPos = this.shadowRoot.activeElement.getAttribute('aria-posinset');
} else {
var nextPos = document.activeElement.getAttribute('aria-posinset');
}
if (!nextPos)
return;
this.movePos(nextPos);
},
Expected behavior
The code should be able to handle such state.
_spaceCatcher: function (e) {
e.preventDefault();
const root = this.shadowRoot || document;
const activeEl = root.activeElement;
if (!activeEl) return;
const nextPosAttr = activeEl.getAttribute('aria-posinset');
if (!nextPosAttr) return;
const nextPos = parseInt(nextPosAttr, 10);
if (Number.isNaN(nextPos)) return;
this.movePos(nextPos - 1);
},
Minimal reproducible example
No response
Add-on Version
3.0.1
Vaadin Version
24.10.1
Additional information
No response
Describe the bug
We get the following error tracked via Sentry:
can't access property "getAttribute", this.shadowRoot.activeElement is nullwhich is caused by that code:
Expected behavior
The code should be able to handle such state.
Minimal reproducible example
No response
Add-on Version
3.0.1
Vaadin Version
24.10.1
Additional information
No response