-
Notifications
You must be signed in to change notification settings - Fork 359
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
Add bootstrap5 theme #3222
Add bootstrap5 theme #3222
Conversation
I wonder if we can reduce the template changes even further by re-mapping the data attributes with bs3-compat.js. const dropdownElementList = document.querySelectorAll('[data-dropdown]');
dropdownElementList.forEach((dropdownToggleEl) => {
const target = dropdownToggleEl.getAttribute("data-target");
if (target) {
dropdownToggleEl.setAttribute("data-bs-target", target)
}
});
const dropdownList = [...dropdownElementList].map(
(dropdownToggleEl) => new bootstrap.Dropdown(dropdownToggleEl)
); For the templates that aren't changed from bs3, do we want to inherit those to make it clear which templates we need to update when we make changes? |
I haven't actually tried it yet, but I suspect we'd have trouble with the initialization order of the scripts. We could make bs3-compat run early, but then it could miss something. We'd also have to employ mutation observers for any dynamically loaded content. But I have a couple of other ideas for runtime patching..
My aim currently is to make it so that you could run a script to update bootstrap5 from bootstrap3. This would allow the theme to be completely standalone to avoid any confusion. But inheriting bootstrap3 is certainly an option, and I'm not committed to any specific approach yet. :) |
Regardless of the approach, we could of course leave all template files out of git if the script works. That'd make this PR quite a bit smaller. |
That would definitely make review easier, though of course we'll want to commit the files in the end. (If we're able to go with a script-based approach, we should also add a CI test similar to lessToSass to ensure nobody forgets to keep the files in sync). In any case, I definitely like the fool-proof nature of the script-based approach, if we're able to make that work... and if not, @crhallberg's idea of inheriting files that are unchanged seems like the next best thing. |
I have run the full test suite on this PR. Here are the results: ERRORS! Please let me know if you'd like me to paste more detail here in the PR. |
I've now added a |
@EreMaijala, I see that GitHub is complaining about some things in the Javascript. Are these new issues, or is it re-reporting things we had already investigated in bootstrap3? |
@demiankatz it looks like Javascript that is in bootstrap3 |
I did some additional testing of this branch today and found a couple of new (?) issues with the bootstrap5 and sandal5 themes that don't appear in the legacy themes. Extra X in search box while typingI discovered this while testing the Virtual Keyboard but then realized it's an issue even without that feature enabled. In the two new themes, an extra X appears while entering text and seeing search suggestions. There's only one X visible under the same circumstances in the three legacy themes. NOT SO GOOD - NEW THEMES |
Facets filtering layoutThe layout of the facets lightbox looks different in the new themes vs. the legacy themes. I am not sure that this is a big problem, but it looks strange in the new themes and I think something may be wrong with the styling -- especially since the lightbox behaves better after you resize the browser. NB: facet sorting, filtering, and clearing the search box all behave normally in every theme. Examples come from Sandal vs. Sandal5, but the same is seen in Bootstrap3 vs. Bootstrap5. GOOD BEHAVIOR - LEGACY THEMES When you resize the browser window in the legacy themes, the behavior of the lightbox stays the same – it just gets taller or shorter, as appropriate. QUESTIONABLE BEHAVIOR - NEW THEMES When you resize the browser window, either making it longer or shorter, the scroll bar appears on the right and the CLOSE button pops up from the bottom. This post-resizing appearance/behavior is more in line with what I'd expect. I would prefer that the Sort and Filter options appear on one line at the top of the lightbox in fullscreen. |
Responsive table in search history - not fully implemented in new themesIn reference to PR 3204, each item in the search history should be displayed with information in different shades in alternating rows in mobile view. There should be space between the each "recent search", and each item should have a bit of shading to give it a slightly 3D/raised appearance Search history looks fine in the legacy themes, but in the new themes some of this styling is missing. These screenshots show Bootstrap*, but the same is found in the two versions of Sandal. Bootstrap3 Bootstrap5 |
@sturkel89 Thanks for reporting the issues. They should be fixed now. |
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 think I may have spotted one minor oversight. Other than that, we may be ready, though I'll give @crhallberg a little longer to comment as well.
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.
There's no new feedback from me, but I see @crhallberg has caught a few more small things, so I'm going to put this into "request changes" mode until you have a chance to address his feedback.
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.
Looks like everything we expect to address here has been addressed, and there are a couple of follow-up actions we can take after merging this. Thanks, @crhallberg and @EreMaijala!
This is initial work for adding a bootstrap5 theme that uses Bootstrap 5.x. and to include enough back-compatibility support to make it possible to inherit other themes from it. Still pretty much work in progress but comments welcome.
Principles:
Here are the most significant template changes:
data-toggle="collapse" => data-bs-toggle="collapse"
data-toggle="dropdown" => data-bs-toggle="dropdown"
data-target => data-bs-target
data-dismiss="modal" => data-bs-dismiss="modal"
Other things worth noting:
visually-hidden
replaces thesr-only
class, but the latter is still available via bs3-compat.scss$fa-font-path
has changed too).in
class, bootstrap5 usesopen
active
class on thea
element instead ofli
(bs3-compat.js handles some of this, but style changes may be required as well).npm run build:scssonly
can be used to compile scss for scss-only themes (bootstrap5, sandal5). Alsonpm run build:css
does that.npm install
to be run in the theme directory firstTODO:
TODO (Issues):