Fix BxSelect element not showing label correctly (#449)

This commit is contained in:
redphx
2024-07-19 06:54:00 +07:00
parent 2ecd995e47
commit 66123bc4ef
4 changed files with 27 additions and 30 deletions

View File

@@ -183,14 +183,14 @@ export class ControllerShortcut {
$fragment.appendChild($option);
}
$container.dataset.hasGamepad = hasGamepad.toString();
if (hasGamepad) {
$select.appendChild($fragment);
$select.selectedIndex = 0;
$select.dispatchEvent(new Event('change'));
$select.dispatchEvent(new Event('input'));
}
$container.dataset.hasGamepad = hasGamepad.toString();
}
static #switchProfile(profile: string) {
@@ -205,9 +205,9 @@ export class ControllerShortcut {
const $select = ControllerShortcut.#$selectActions[button as GamepadKey]!;
$select.value = actions[button] || '';
BxEvent.dispatch($select, 'change', {
ignoreOnChange: true,
});
BxEvent.dispatch($select, 'input', {
ignoreOnChange: true,
});
}
}