Skip to content

Commit

Permalink
Merge pull request #172 from duhrer/GH-160
Browse files Browse the repository at this point in the history
GH-160: Fix number pad styles.
  • Loading branch information
duhrer authored Feb 26, 2024
2 parents 797382f + 88c50cf commit 0c36179
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/css/onscreen-keyboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ button.osk-key {
padding: clamp(0.2rem, 0.75vw, 0.75rem);
width: clamp(0.75rem, 4.5vw, 4.5rem);
}

.gamepad-navigator-numpad .osk-text-input {
width: clamp(5rem, 25vw, 25rem);
}
2 changes: 1 addition & 1 deletion src/js/content_scripts/focus-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

gamepad.focusOverlay.shouldDisplayOverlay = function (that) {
var fixFocus = fluid.get(that, "model.prefs.fixFocus") ? true : false;
var hideFocusOverlay = !fixFocus || !that.model.focusOverlayElement || that.model.activeModal;
var hideFocusOverlay = !fixFocus || !that.model.focusOverlayElement;
that.applier.change("hideFocusOverlay", hideFocusOverlay);
};
})(fluid);
9 changes: 6 additions & 3 deletions src/js/content_scripts/input-mapper-content-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ https://github.com/fluid-lab/gamepad-navigator/blob/main/LICENSE
return element.nodeName === "INPUT" && (element.getAttribute("type") === "number" || element.getAttribute("inputmode") === "decimal");
};

gamepad.inputMapperUtils.content.isSteppable = function (element) {
return element.nodeName === "INPUT" && (element.getAttribute("type") === "number" || gamepad.inputMapperUtils.content.isRangeInput(element));
};

gamepad.inputMapperUtils.content.isRangeInput = function (element) {
return element.nodeName === "INPUT" && element.getAttribute("type") === "range";
};
Expand Down Expand Up @@ -479,9 +483,8 @@ https://github.com/fluid-lab/gamepad-navigator/blob/main/LICENSE
var activeElement = that.model.activeModal ? fluid.get(that, "model.shadowElement.activeElement") : document.activeElement;

if (activeElement) {
var isNumberInput = gamepad.inputMapperUtils.content.isNumberInput(activeElement);
var isRangeInput = gamepad.inputMapperUtils.content.isRangeInput(activeElement);
if (isNumberInput || isRangeInput) {
var isSteppable = gamepad.inputMapperUtils.content.isSteppable(activeElement);
if (isSteppable) {
switch (key) {
case "ArrowLeft":
case "ArrowDown":
Expand Down
8 changes: 3 additions & 5 deletions src/js/content_scripts/keyboards.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ https://github.com/fluid-lab/gamepad-navigator/blob/main/LICENSE
fluid.defaults("gamepad.osk.keyboard.numpad", {
gradeNames: ["osk.keyboard"],
rowDefs: [
[osk.keydefsByCode.ArrowLeft, osk.keydefsByCode.ArrowRight, gamepad.osk.keyboard.numpad.keydefs.Backspace ],
[gamepad.osk.keyboard.numpad.keydefs.Digit1, gamepad.osk.keyboard.numpad.keydefs.Digit2, gamepad.osk.keyboard.numpad.keydefs.Digit3 ],
[gamepad.osk.keyboard.numpad.keydefs.Digit4, gamepad.osk.keyboard.numpad.keydefs.Digit5, gamepad.osk.keyboard.numpad.keydefs.Digit6 ],
[gamepad.osk.keyboard.numpad.keydefs.Digit7, gamepad.osk.keyboard.numpad.keydefs.Digit8, gamepad.osk.keyboard.numpad.keydefs.Digit9 ],
[gamepad.osk.keyboard.numpad.keydefs.Comma, gamepad.osk.keyboard.numpad.keydefs.Digit0, gamepad.osk.keyboard.numpad.keydefs.Period ]
[gamepad.osk.keyboard.numpad.keydefs.Digit1, gamepad.osk.keyboard.numpad.keydefs.Digit2, gamepad.osk.keyboard.numpad.keydefs.Digit3, gamepad.osk.keyboard.numpad.keydefs.Digit4, gamepad.osk.keyboard.numpad.keydefs.Digit5],
[gamepad.osk.keyboard.numpad.keydefs.Digit6, gamepad.osk.keyboard.numpad.keydefs.Digit7, gamepad.osk.keyboard.numpad.keydefs.Digit8, gamepad.osk.keyboard.numpad.keydefs.Digit9, gamepad.osk.keyboard.numpad.keydefs.Digit0 ],
[gamepad.osk.keyboard.numpad.keydefs.Comma, gamepad.osk.keyboard.numpad.keydefs.Period, osk.keydefsByCode.ArrowLeft, osk.keydefsByCode.ArrowRight, gamepad.osk.keyboard.numpad.keydefs.Backspace ]
]
});

Expand Down

0 comments on commit 0c36179

Please sign in to comment.