Skip to content

Commit

Permalink
Virtual keyboard: Avoid !important with more specific selectors, esca…
Browse files Browse the repository at this point in the history
…pe attrs properly. (#3221)

- Avoid !important with more specific selectors, escape attrs properly.
- Prevent navigation to empty anchor when selecting a keyboard.
  • Loading branch information
EreMaijala authored Nov 16, 2023
1 parent 7bc4821 commit cd00a63
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion themes/bootprint3/css/compiled.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/bootstrap3/css/compiled.css

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion themes/bootstrap3/js/searchbox_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ VuFind.register('searchbox_controls', function SearchboxControls() {
_KeyboardClass = window.SimpleKeyboard.default;
_KeyboardLayoutClass = window.SimpleKeyboardLayouts.default;

$('.keyboard-selection-item').on("click", function updateLayoutOnClick(){
$('.keyboard-selection-item').on("click", function updateLayoutOnClick(ev) {
_updateKeyboardLayout($(this).data("value"));
ev.preventDefault();
});

_textInput.addEventListener("focus", () => {
Expand Down
19 changes: 10 additions & 9 deletions themes/bootstrap3/less/components/keyboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

#keyboard-selection-button {
padding: 0 2px 0 4px !important;
padding: 0 2px 0 4px;
.icon {
margin: 0;
}
Expand Down Expand Up @@ -61,25 +61,26 @@
display: none;
position: absolute;
z-index: 1;
background-color: #dddddd !important;

&.hg-theme-default {
background-color: #dddddd;
}

.hg-functionBtn {
.hg-button.hg-functionBtn {
font-weight: bold;
font-size: 30px;
background-color: #f4f4f4 !important;
background-color: #f4f4f4;
span {
padding-top: 5px;
}

&.hg-button-space {
background-color: white;
}
}

.hg-standardBtn {
font-size: 18px;
}

.hg-button-space {
background-color: white !important;
}
}

.show-keyboard {
Expand Down
19 changes: 10 additions & 9 deletions themes/bootstrap3/scss/components/keyboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

#keyboard-selection-button {
padding: 0 2px 0 4px !important;
padding: 0 2px 0 4px;
.icon {
margin: 0;
}
Expand Down Expand Up @@ -61,25 +61,26 @@
display: none;
position: absolute;
z-index: 1;
background-color: #dddddd !important;

&.hg-theme-default {
background-color: #dddddd;
}

.hg-functionBtn {
.hg-button.hg-functionBtn {
font-weight: bold;
font-size: 30px;
background-color: #f4f4f4 !important;
background-color: #f4f4f4;
span {
padding-top: 5px;
}

&.hg-button-space {
background-color: white;
}
}

.hg-standardBtn {
font-size: 18px;
}

.hg-button-space {
background-color: white !important;
}
}

.show-keyboard {
Expand Down
4 changes: 2 additions & 2 deletions themes/bootstrap3/templates/search/searchbox.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<div class="searchForm-query input-group">
<input<?=$this->htmlAttributes($searchboxAttributes)?>>
<div id="searchForm_controls">
<button id="searchForm-reset" class="searchForm-reset hidden" type="reset" tabindex="-1" aria-label="<?=$this->transEsc('searchform_reset_button')?>"><?=$this->icon('ui-reset-search');?></button>
<button id="searchForm-reset" class="searchForm-reset hidden" type="reset" tabindex="-1" aria-label="<?=$this->transEscAttr('searchform_reset_button')?>"><?=$this->icon('ui-reset-search');?></button>
<?php if (!empty($keyboardLayouts)): ?>
<?php
$this->headScript()->appendFile('vendor/js.cookie.js');
Expand All @@ -121,7 +121,7 @@
</li>
<?php foreach ($keyboardLayouts as $keyboardLayout): ?>
<li>
<a class="keyboard-selection-item" href="#" data-value="<?= $keyboardLayout ?>"><?= $this->transEsc($keyboardLayout) ?></a>
<a class="keyboard-selection-item" href="#" data-value="<?= $this->escapeHtmlAttr($keyboardLayout) ?>"><?= $this->transEsc($keyboardLayout) ?></a>
</li>
<?php endforeach; ?>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion themes/local_theme_example/css/compiled.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/sandal/css/compiled.css

Large diffs are not rendered by default.

0 comments on commit cd00a63

Please sign in to comment.