Skip to content

Bootstrap tooltip and glossary UI fixes#334

Merged
ozancinar merged 4 commits intomainfrom
glossary-ui-fixes
Mar 12, 2026
Merged

Bootstrap tooltip and glossary UI fixes#334
ozancinar merged 4 commits intomainfrom
glossary-ui-fixes

Conversation

@jmillanacosta
Copy link
Member

  • Add opt-in button
  • No more conflicts with bootstrap's tooltip
  • Simplified logic
  • Added some tags to exclude that caused issues
Screencast.from.11-03-26.14.22.04.webm

The button can be moved, and since it's clicking now maybe it makes mroe sense to have a true tooltip and not force it to the bottom left corner, what would look better?

@jmillanacosta jmillanacosta self-assigned this Mar 11, 2026
@jmillanacosta jmillanacosta marked this pull request as ready for review March 11, 2026 13:26
@jmillanacosta jmillanacosta changed the title Glossary UI fixes Bootstrap tooltip and glossary UI fixes Mar 11, 2026
@jmillanacosta
Copy link
Member Author

You can remove the custom bootstrap css to make it behave like a common tooltip, but I figured that could bring some unexpected issues, so if we decide to have it behave like a normal tooltip (show it below the word) I'd still keep the custom class

'script', 'style', 'noscript', 'iframe', 'object',
'button', 'select', 'option', 'textarea', 'input',
'a', 'label', 'code', 'pre', 'kbd', 'samp', 'var',
'nav', 'footer', 'header',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add h1, h2, ..., h6 here. Glossary in headlines looks funny. Often the text below picks up the title again. If not we should write more explanatory text anyways. But since now we have it user requested I'm less strict on this. The user clearly wants explanation.

Example VHP4 safety headline:

Image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely! 👍 The less we have here the less can interfere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bootstrap-custom.css is compiled via npx, do not change manually.
If will not be persisted if people modify the sass maps and compile how it is designed. Guidelines are in the readme on how to go from sass maps to bootstrap-custom.css.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this would be the place where we would systematically change the appearance of all tooltips. The black is a bit very sad in contrast to our vhp4-safety colorscheme. But I would make that a separate issue. No need to act on this now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed that was stale because of the many lines that disappeared when compiling, fixed it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

function setGlossaryVisible(visible) {
glossaryActive = visible;
document.querySelectorAll('[data-vhp-glossary]').forEach(span => {
span.classList.toggle('bg-vhpblue', visible);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The accent color is different on each page, however I would like to argue in favour of bg-vhplight-blue:

  • it is the accent color used in most of the website. And due to the strip at the bottom being vhplight-blue and the shape being also a stripe it would be most harmonic in vhplight-blue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied

glossaryActive = visible;
document.querySelectorAll('[data-vhp-glossary]').forEach(span => {
span.classList.toggle('bg-vhpblue', visible);
span.classList.toggle('bg-opacity-10', visible);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the user actively WANTS to see the glossary, I don't think we still need to be as subtle as we were in the general one-for-all solution.

Hence, I propose to turn it up a notch:

bg-opacity-50

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied

glossaryActive = visible;
document.querySelectorAll('[data-vhp-glossary]').forEach(span => {
span.classList.toggle('bg-vhpblue', visible);
span.classList.toggle('bg-opacity-10', visible);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also propose to add:

rounded

Even prettier, I think would be rounded-pill px-2 but I can live with rounded only, albeit it mimics a lot our buttons (which not being too bad actually given that we want people to click on the glossary buttons now).

<!-- Tools Button Group -->

<!-- Glossary Toggle -->
<button id="glossary-toggle" class="btn btn-outline-vhpblue btn-sm text-nowrap" type="button"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button radio-toggle is not really a link, so I would like to make visual distinction between buttons and the toggle. Bootstrap5 comes with a fromcheck switch:

Hence change this buttom to something along these lines:

<div class="form-check form-switch">
  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckChecked" checked>
  <label class="form-check-label" for="switchCheckChecked">Checked switch checkbox input</label>
</div>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied

<!-- Data button -->
<button class="btn btn-vhpteal mt-2" onclick="location.href='/data'" data-bs-dismiss="offcanvas">Data</button>

<button class="btn btn-outline-vhpblue mt-2" type="button" data-vhp-glossary-skip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

const btn = document.getElementById('glossary-toggle');
if (btn) {
new bootstrap.Tooltip(btn);
btn.addEventListener('click', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current solution depends on the user making the choice to glossary on each subpage again and again.
I suggest we either store sessionStorage (per tab and clears after user closes), or localStorage (persistence across browser closing) to save the user's choice. Then roll with that, will be a smoother experience.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uses localStorage and finds the value on boot

@johannehouweling
Copy link
Collaborator

image

This breaks bg-vhplight-green because likely someone just put it into custom-boostrap.css manually.

@jmillanacosta
Copy link
Member Author

image

This breaks bg-vhplight-green because likely someone just put it into custom-boostrap.css manually.

That's why I didn't build scss at first, better to patch it in main before merging this branch

@johannehouweling
Copy link
Collaborator

johannehouweling commented Mar 11, 2026

image

Can we add to the sass map that we style the switch in line with other colors? I suggest the color of the search button?

$form-check-input-checked-bg-color: map-get($theme-colors, "vhppurple"); 
$form-check-input-checked-border-color: map-get($theme-colors, "vhppurple");

Also wouldn't mind if the tooltip bg color were the vhppurle too:

image image

@johannehouweling
Copy link
Collaborator

johannehouweling commented Mar 11, 2026

image

👍
Confirm, fixes #327

@johannehouweling
Copy link
Collaborator

johannehouweling commented Mar 11, 2026

Depends on #336

@johannehouweling
Copy link
Collaborator

image Can we add to the sass map that we style the switch in line with other colors? I suggest the color of the search button?
$form-check-input-checked-bg-color: map-get($theme-colors, "vhppurple"); 
$form-check-input-checked-border-color: map-get($theme-colors, "vhppurple");

Also wouldn't mind if the tooltip bg color were the vhppurle too:

image image

Actually, #341 changes the search menu, so has no longer a search button which was basically without function, so a bit more room for coloring of the switch toggle, I would just not make it yet another color (and bg-primary it is atm).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@ozancinar ozancinar merged commit 120cc3a into main Mar 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glossary too invasive. Popper/Bootstrap tooltips broken due to glossary highlighter

3 participants