-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Bootstrap 5 #1182
Update to Bootstrap 5 #1182
Conversation
"twitter/bootstrap": "3.3.*", | ||
"twitter/typeahead.js": "v0.10.5", | ||
"twbs/bootstrap": "5.0.*", | ||
"twitter/typeahead.js": "v0.11.*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: before making it a final PR, confirm whether there's a new version of twbs/bootstrap and update here if necessary.
dockerfiles/Dockerfile.ubuntu
Outdated
|
||
|
||
# Configure Skosmos | ||
COPY dockerfiles/config/config-docker.ttl /var/www/html/config.ttl | ||
# COPY dockerfiles/config/config-docker.ttl /var/www/html/config.ttl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: this is to speed up development, mapping the Docker volume. Undo all the changes to the Dockerfiles when the PR is ready for review.
eea1104
to
69c0f65
Compare
view/concept-shared.twig
Outdated
for="#{% if concept.notation %}notation{% else %}pref-label{% endif %}"> | ||
<span class="glyphicon glyphicon-copy" aria-hidden="true"></span> | ||
<button type="button" data-bs-toggle="tooltip" data-bs-placement="button" title="Copy to clipboard" class="btn btn-default btn-xs copy-clipboard" for="#{% if concept.notation %}notation{% else %}pref-label{% endif %}"> | ||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#00748f"><path d="M0 0h24v24H0z" fill="none"/><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glyphicons is not free anymore, and Bootstrap dropped it in Bootstrap 4. I've used this SVG from Google Material Icons, but we can use another one instead too 👍
@osma I believe this PR is ready for an initial round of reviews. Here's how I tested:
You'll notice I've changed the In one monitor then I have http://localhost:9090 with Skosmos + Bootstrap v5, and in another monitor I have skosmos.dev.finto.fi/en/ with Skosmos + Bootstrap v3. But this is not the only way to review. If you have a working PHP installation and you are more comfortable using it, feel free to check out this branch and try it. The docker changes should not interfere with your review 👍 Thanks! |
Thanks a lot @kinow , I will review this and get back to you soon! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this locally (no docker involved). I was surprised about how smooth the upgrade seems to be, even though this is skipping directly from Bootstrap 3 to 5!
That said, I found some issues. I used Firefox 90 on Ubuntu 20.04 for testing.
Functional:
- (This could be related to the Typeahead upgrade you did in this PR.) When inside a vocabulary, the search box is doing an unrestricted global search instead of searching within the vocabulary and the chosen language. This means the search is slow and returns results also from other vocabularies, e.g.
I checked the AJAX query and it looks like this:rest/v1/search?query=aardva*
while in the old version it looks like this:rest/v1/search?query=aardv*&vocab=yso&lang=en&labellang=en
- so clearly the URL parameters are not being set correctly. The same happens also on the front page where the search is (by default) global; the query is justrest/v1/search?query=aardva*
when it should be e.g.rest/v1/search?query=aardv*&vocab=&lang=en&labellang=en
Display-related:
- The Fira font is not being applied to many elements. Here are some examples where I'm seeing another font (Arial?) instead:
These were just some obvious ones, there could be more.
- I tested how the layout works on narrower devices using Responsive Design mode. There seems to be a lot of empty space on e.g. the vocabulary information page:
-
In the search bar, the font size has increased a little bit.
-
The copy to clipboard icon - I understand the issue with Glyphicons. I think we may want to choose a different icon than the one you selected though. I will get back about this. Also, I think it would be better to avoid embedding the SVG icon in the HTML code. The icon is already used in a couple of places and there could be more in e.g. Skosmos plugins, so either a CSS rule (like glyphicons) or a separate image file would be better.
Keep up the good work!
Hi @osma ! Thanks for the excellent feedback (as always!). I was looking only at CSS changes and didn't see the URL query parameters change, nice catch! Will go through your feedback in the next days and update this PR. |
Fixed. You were correct @osma , Typeahead changed its syntax, so I had to read their docs and update the code. I beleive now the result should be the same as before 👍 |
Bootstrap 5 has a CSS variable that is setting the font to the OS default sans-serif font. There's also a reset.css or reboot.css I think, that resets other font attributes. The issue is that in Bootstrap 3 we didn't have that, so now Bootstrap 5 is trying to be helpful by resetting font attributes, but overriding some of what we had defined. I've added the |
Three more to go! Will have to stop for today, but will pick it up in the next day(s). |
Fixed setting the document root font size. Usually I try to avoid touching the root properties, but Bootstrap is doing the same, but now with a bigger font. We don't have SASS or SCSS in our build toolchain, otherwise I could alter Bootstrap's variable. For now I think this will do (later if the UI build changes it should be simpler to update it). |
👍
Good idea. Moved it to an external file, so we can just swap the file and it should be updated. |
Hmm, you are right. I was using Firefox I think I addressed your initial feedback @osma. Let me know if there are other items pending, otherwise I will have another look at the differences one day of this week (so I stop comparing it for a while; will choose a day when 🧠 is happy and fresh, so I'm able to spot more differences). Cheers |
Woah! That's an impressive review @osma !! I'll try to update the branch again fixing these bugs. The ones where items are not aligned really bug me, but I missed them sorry. At least I think we are getting close to a working Skosmos+Bootstrap5, and this PR appears to be going in the right direction 🎉 🕺 thanks!!! |
To start, I just want to say that this is an awesome WIP @kinow and I just wanted to give it a try! Some remarks not yet covered by @osma :
Keep up the good work! :) |
Thanks for the review @kouralex ! The more the merrier. Noted the issues found, will start fixing them slowly soon 🤓 |
@osma, thank you for the feedback.
Good spot! Bootstrap 5 defines the link hover color for navigation links. Had to override that one.
This was the hardest to tackle. I had noticed this regression, but forgot to point it out, sorry. Basically, Bootstrap 5 uses flex elements to create the pagination. Browsers implement grid & flex nowadays, and it's a lot easier to work with these than trying to align items ourselves (main justifications for moving to grid or flex). Looks like the flex model adds some kind of virtual border, as the width of the elements was the same in old & new. I reduced the width of the element from 26px to 24px, and now the pagination layout is looking a bit closer to the old design. WDYT @osma?
Tried to match the previous layout. It's tricky because of the structure changes from Bootstrap 3 to 5. But I think I got the elements re-aligned. Not identical, but the down-arrow should look better aligned. I spent some time trying to understand why I was getting different spacing for the two down-arrows/carets in the screen. Turns out the one in the top had the text "English", and the one next to the search field had "English " with an extra space.
Ah, I hadn't noticed it! I caused this bug when using
I think I got it fixed now. The clipboard icon is getting in the way of the row element. I've changed it a bit, but I think we will revisit it later when we decide which icon to use as replacement for glyphicon (now paid).
I couldn't find what change caused that, so my best guess is that typeahead changed something in its CSS and caused that? I reduced the width of the suggestion box in 2 pixels, and then moved the box 1 pixel to the right. The border has 1 pixel to each side (top, right, bottom, left), so that should position the suggestion box exactly below with the border and no content overflowing the search input.
Fixed by one of the changes above. Couldn't reproduce it on Chromium or Firefox. Could you test it again, please @osma?
Oh, interesting. @osma, I've applied the Fira font to the Going to work on @kouralex feedback now. Thanks! |
Hi @kouralex,
Turns out there's a limit now in Typeahead, that defaults to 5. I've added a variable in the
I think @osma had provided a similar feedback. I changed the border/width of the tt-menu, and it looks aligned on chromium/ffox. Could you check if that looks better now? If not, could you share your environment settings, please? Then I will try to reproduce locally.
I zoomed in and opened two browser windows with old & new skosmos to compare the dropdowns. I tried to match the layout & behaviour. And I must admit it was really different, thanks for pointing the differences @kouralex! Could you take another look and see if it's better, or at least going in the right direction?
I just tested with YSO, STW, and UNESCO vocabularies, and the alphabetical index loaded correctly, I think. Could you confirm if that's still an issue, please, @kouralex? Thanks a lot for the review! |
The I'm trying to think of a quick fix to make it work better. |
After many little last minute tweaks I think this is now good enough for merging 🎉 |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Finto CSS (for dev.finto.fi which is always running current |
Thank you for reviewing and fixing the PR too @osma ! I'll keep an eye open for Bootstrap & layout issues in Finto & |
Closes #1045