? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
4 Jun 2018

Use navbar-nav class for menus and don't use flex-column for Bootstrap 4 menus.

Pull Request for Issue # ?.

Summary of Changes

This Pull Request (PR) changes the default template of mod_menu so the ul item's class is navbar-nav instead of nav, and the flex-column class is removed from that item.

The flex-column class made it impossible to get horizontal menus, see picture in section "Actual result" below.

After removing the flex-column` class, the menu still does not look like on the template's preview picture when using the default Cassiopeia template, see following picture:
intermediate

After changing class nav to navbar-nav, the menu looks like on the template's preview, see picture in section "Expected result" below.

The changes of this PR make the navbar's html fit to the description on
https://www.w3schools.com/bootstrap4/bootstrap_navbar.asp.

Testing Instructions

Use current 4.0-dev branch with the default Cassiopeia frontent template and have a menu in module position menu which should be shown in horizontal direction, and some other menus in some side position shown in vertical direction.

I used blog testing data and moved the "Main Menu Blog" module to the menu position. In the module's advanced setting there is no class suffix defined for the module or the menu.

Check that the menu at the menu position (left beside the search box) is shown as expected with this PR applied.

Check that the look of all other things on the page has not changed after applying this PR.

Check with your browser's developer tools that the navbar's html fits to what is described on
https://www.w3schools.com/bootstrap4/bootstrap_navbar.asp.

Expected result

See following picture with the menu marked with a red ellipse:
after

Actual result

See following picture with the menu marked with a red ellipse:
before

Documentation Changes Required

None.

avatar richard67 richard67 - open - 4 Jun 2018
avatar richard67 richard67 - change - 4 Jun 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Jun 2018
Category Modules Front End
avatar richard67 richard67 - change - 4 Jun 2018
Title
Use navbar-nav class for menus, remove flex-column
[4.0] Use navbar-nav class for menus, remove flex-column
avatar richard67 richard67 - edited - 4 Jun 2018
avatar richard67 richard67 - change - 4 Jun 2018
The description was changed
avatar richard67 richard67 - edited - 4 Jun 2018
avatar richard67 richard67 - change - 4 Jun 2018
The description was changed
avatar richard67 richard67 - edited - 4 Jun 2018
avatar richard67 richard67 - change - 4 Jun 2018
The description was changed
avatar richard67 richard67 - edited - 4 Jun 2018
avatar richard67 richard67 - edited - 4 Jun 2018
avatar richard67 richard67 - change - 4 Jun 2018
The description was changed
avatar richard67
richard67 - comment - 4 Jun 2018

@C-Lodder Can you check if this PR is correct?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20661.

avatar richard67
richard67 - comment - 4 Jun 2018

@ciar4n Can you check if this PR is correct?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20661.

avatar dgrammatiko
dgrammatiko - comment - 4 Jun 2018

@richard67 I think the idea was not to couple the menu to the bootstrap classes and you're reverting this...

avatar richard67
richard67 - comment - 4 Jun 2018

@dgrammatiko So I shall close this PR? Any other idea how I can get a horizontal menu with the Cassiopeia template? Maybe even with nav-pills working?

avatar dgrammatiko
dgrammatiko - comment - 4 Jun 2018

Let's ask @ciar4n here, I have no clue what the final decisions on templates are...

avatar richard67
richard67 - comment - 4 Jun 2018

Ok, am waiting for reply and will of course close this PR if advised to do so.

avatar richard67
richard67 - comment - 4 Jun 2018

@dgrammatiko For the navbar-nav class it is right what you say, that it couples the menu to boostrap classes again, so this should maybe be reverted, but I think that removing the flex-column could be a valid change. Maybe @ciar4n can check that, too?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20661.

avatar mbabker
mbabker - comment - 4 Jun 2018

@richard67 I think the idea was not to couple the menu to the bootstrap classes and you're reverting this...

So changing one Bootstrap class (.flex-column) with another (.navbar-nav) means a tighter coupling to Bootstrap? Are we really not going to be allowed to use ANYTHING in the frontend if it has a corresponding selector in the Bootstrap SCSS?

avatar dgrammatiko
dgrammatiko - comment - 4 Jun 2018

I thought .flex-column was our own class not BS, if not the case then my comments are out of scope

avatar mbabker
mbabker - comment - 4 Jun 2018

I thought the same thing until this morning. Then I used my Google-fu to confirm ?

avatar richard67
richard67 - comment - 4 Jun 2018

@dgrammatiko @mbabker So is this PR right now? PR wrong? Or partly right?

avatar mbabker
mbabker - comment - 4 Jun 2018

At a glance, not a clue. I ripped most of the BS out of the one BS4 build I have (which incidentally enough doesn't use their nav component at all) ?.

Based on your screenshot it looks right though.

avatar mbabker
mbabker - comment - 4 Jun 2018

Or, it's purposefully excluded from the menu module because the module can be used in other positions and that class might tie you to use in that position of this particular template's design. I honestly don't know what's going on with the new templates off hand.

avatar richard67
richard67 - comment - 4 Jun 2018

@mbabker Then there should be maybe no class at all hard-coded in the module, neither nav nor navbar-nav nor flex-column, and class= is added only if $class_sfx is not empty, i.e. all classes are set with $class_sfx and nothing is hard-coded in default.php?

avatar mbabker
mbabker - comment - 4 Jun 2018

Without a change in the markup structure I'd leave a nav class, to me that should be mildly generic (unfortunately some frameworks claim and use it).

So have one of these constructs in the default module markup, leave the rest to overrides and UI configuration:

<nav class="<?php echo $class_sfx; ?>">
    <ul>
        <li>Thing</li>
    </li>
</nav>
<ul class="nav <?php echo $class_sfx; ?>">
    <li>Thing</li>
</ul>

(Unfortunately even THAT isn't an easy thing, there isn't a good way for a template to "suggest" classes to add to a module so it renders correctly, meaning you get some quirks if you set up a menu module from scratch and forget to copy the right classes into the config, one of those UX things to think about at some point I suppose)

avatar brianteeman
brianteeman - comment - 4 Jun 2018

and dont forget that for a11y it should be wrapped in
<nav role="navigation">

avatar ciar4n
ciar4n - comment - 4 Jun 2018

I think this PR is correct in removing the flex-column. I am not so sure about adding navbar-nav as it is more by accident rather than by design that it works in the column styled modules (correct me if I am wrong). Maybe better to apply the row flex-direction in the template CSS for the header module position.

avatar richard67
richard67 - comment - 5 Jun 2018

Am not sure if I am the right guy to solve that, since I don't have any idea how it is intended to be and how templates with scss work.
Shall I change this PR so it only removes the flex-column? Or shall I try to find out what to do in scss in addition so the menu looks good in any position? Or shall I close this PR completely and let someone else with more knowledge on all that do it?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20661.

avatar richard67
richard67 - comment - 5 Jun 2018

Or maybe it needs to create an override for the menu default view in the Cassiopeia template?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20661.

avatar richard67
richard67 - comment - 6 Jun 2018

@mbabker I should not wrap the ul element into a nav inside modules/mod_menu/tmpl/default.php because there is already a nav element in the Cassiopeia template's index.php which wraps the menu module position.

@brianteeman For the same reason I won't add role="navigation" because the Cassiopeia template's index.php is out of scope of this PR (up to now). And I am not sure if it needs the role="navigation" for a nav element because nav is made for that purpose already, i.e. can be ignored by screen readers per definition.

@ciar4n It seems that the Cassiopeia template needs some work to be done for making horizontal menus and menu classes like nav-pills work. Because you are mentioned as one of the 2 authors of that template I had pinged you here. If you (or anyone else) can give me any idea which way to go, e.g. if the nav element shall stay where it is now in the Cassiopeia template's index.php or if it should be moved to modules/mod_menu/tmpl/default.php, and how the (s)css shall be handled (bootstrap or own styles), then I am willing to do some work and make a better PR. But right now, as long as I have no idea in which direction to go, I will better not do that in order not to mess up things.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20661.

avatar richard67
richard67 - comment - 9 Jun 2018

Closing in favour of PR #20700 .

avatar richard67 richard67 - change - 9 Jun 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-06-09 08:39:28
Closed_By richard67
Labels Added: ?
avatar richard67 richard67 - close - 9 Jun 2018

Add a Comment

Login with GitHub to post a comment