Skip to content

Commit

Permalink
fix(web): fixes doc-kbd display of default layer when it's not define…
Browse files Browse the repository at this point in the history
…d first
  • Loading branch information
jahorton committed Oct 30, 2023
1 parent a75cd6d commit b2a358f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/src/engine/osk/src/keyboard-layout/oskLayerGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default class OSKLayerGroup {
const layerObj = new OSKLayer(vkbd, layout, layer);
this.layers[layer.id] = layerObj;

// Always make the first layer visible
layerObj.element.style.display = (n==0 ? 'block' : 'none');
// Always make the 'default' layer visible by default.
layerObj.element.style.display = (layer.id == 'default' ? 'block' : 'none');

// Add layer to group
lDiv.appendChild(layerObj.element);
Expand Down
2 changes: 2 additions & 0 deletions web/src/engine/osk/src/visualKeyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,8 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
// Add a faint border
kbd.style.border = '1px solid #ccc';

kbdObj.updateState(); // double-ensure that the 'default' layer is properly displayed.

// Once the element is inserted into the DOM, refresh the layout so that proper text scaling may apply.
const detectAndHandleInsertion = () => {
if(document.contains(kbd)) {
Expand Down

0 comments on commit b2a358f

Please sign in to comment.