fix: additional null check on accessibility object (#1862)

refs: QMFE-CORE-1A

Signed-off-by: Johan Enell <johan.enell@qlik.com>
This commit is contained in:
Johan Enell
2025-12-05 14:35:28 +01:00
committed by GitHub
parent e225609057
commit 3287508baa

View File

@@ -1257,7 +1257,7 @@ export function useKeyboard() {
if (!currentComponent.__hooks.accessibility.exitFunction) {
const exitFunction = function (resetFocus = false) {
const acc = this.__hooks.accessibility;
if (acc.enabled && acc.active) {
if (acc && acc.enabled && acc.active) {
blur(this);
focusHandler && focusHandler.blurCallback && focusHandler.blurCallback(resetFocus);
}
@@ -1267,7 +1267,7 @@ export function useKeyboard() {
const focusFunction = function () {
const acc = this.__hooks.accessibility;
if (acc.enabled && !acc.active) {
if (acc && acc.enabled && !acc.active) {
focusHandler && focusHandler.blurCallback && focusHandler.blurCallback(false);
focus(this);
}
@@ -1277,7 +1277,7 @@ export function useKeyboard() {
const focusSelectionFunction = function (focusLast = false) {
const acc = this.__hooks.accessibility;
if (acc.enabled) {
if (acc && acc.enabled) {
focusHandler && focusHandler.focusToolbarButton && focusHandler.focusToolbarButton(focusLast);
}
}.bind(currentComponent);