? ? Pending

User tests: Successful: Unsuccessful:

avatar thednp
thednp
9 Feb 2021

Summary of Changes

Updated layout file according to Bootstrap 5 new markup

  • the active class no longer required for the <label> element
  • the <input> is no longer inside the <label> element
  • the new markup requires no bootstrap.Button plugin functionality anymore, everything is pure CSS

Details on the updated markup
https://getbootstrap.com/docs/5.0/components/button-group/#checkbox-and-radio-button-groups

Pull Request for Issues #32366 and #32275.

Testing Instructions

  • Open site/templates/cassiopeia/templateDetails.xml
  • Create a new field inside the <fieldset name="advanced">, here a quick example
<field
  name="my-radio"
  type="Radio"
  default="0"
  class="btn-group"
  label="Radio Test">
  <option value="0">Disabled</option>
  <option value="1">Enabled</option>
</field>
  • Login to site/administrator
  • go to System -> Site Template Styles -> Cassiopeia
  • Check the new Radio Test, it should work perfect

Actual result BEFORE applying this Pull Request

The layout won't work with the new Bootstrap 5 CSS and Markup. The JavaScript for radio / checkboxes toggling has been deprecated in favor of a more traditional markup and adjusted CSS.

Expected result AFTER applying this Pull Request

If instructed as above. or in any case of a Radio field used with class="btn-group" attribute, the radio input works properly in the sense that showcases the correct chosen option on any user selection.

Notice

Due to the radio/checkboxes toggle functionality being deprecated in Bootstrap 5 (but replaced with a new CSS + Markup solution) we might need to check for any redundant JavaScript related.

Documentation Changes Required

None

avatar thednp thednp - open - 9 Feb 2021
avatar thednp thednp - change - 9 Feb 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Feb 2021
Category Layout
avatar thednp thednp - change - 9 Feb 2021
The description was changed
avatar thednp thednp - edited - 9 Feb 2021
avatar thednp thednp - change - 9 Feb 2021
The description was changed
avatar thednp thednp - edited - 9 Feb 2021
avatar thednp thednp - change - 9 Feb 2021
The description was changed
avatar thednp thednp - edited - 9 Feb 2021
avatar thednp thednp - change - 9 Feb 2021
The description was changed
avatar thednp thednp - edited - 9 Feb 2021
avatar Quy Quy - test_item - 9 Feb 2021 - Tested successfully
avatar Quy
Quy - comment - 9 Feb 2021

I have tested this item successfully on c53b0c6


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

avatar thednp thednp - change - 9 Feb 2021
Title
Update buttons.php layout according to latest Bootstrap 5 markup
[4.0] Update buttons.php layout according to latest Bootstrap 5 markup
avatar thednp thednp - edited - 9 Feb 2021
avatar thednp thednp - change - 9 Feb 2021
The description was changed
avatar thednp thednp - edited - 9 Feb 2021
avatar OctavianC OctavianC - test_item - 10 Feb 2021 - Tested successfully
avatar OctavianC
OctavianC - comment - 10 Feb 2021

I have tested this item successfully on c53b0c6

It fixes #32366 and #32275


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

avatar thednp thednp - change - 10 Feb 2021
The description was changed
avatar thednp thednp - edited - 10 Feb 2021
avatar infograf768
infograf768 - comment - 10 Feb 2021

Agree this solves the original issue but here is the difference between using bootstrap button and switcher:

To compare I modified the Cassiopea Sticky header field to

				<field
					name="stickyHeader"
					type="radio"
					label="TPL_CASSIOPEIA_STICKY_LABEL"
					class="btn-group"
					default="0"
					filter="integer"
					>
					<option value="0">JNO</option>
					<option value="1">JYES</option>
				</field>

Screen Shot 2021-02-10 at 09 58 05

Screen Shot 2021-02-10 at 10 30 35

There is no background color difference between Yes and No.
Also, is this totally a11y compliant?

avatar richard67 richard67 - change - 10 Feb 2021
The description was changed
avatar richard67 richard67 - edited - 10 Feb 2021
avatar thednp
thednp - comment - 10 Feb 2021

@infograf768 regarding the Sticky Header option you have

here's how it should work
yesno

In regards to a11y, I don't think there are any issues when compared to previous version.

avatar thednp
thednp - comment - 10 Feb 2021

@infograf768 I will provide a fix for the layout to work with btn-group-yesno asap, a small bug I found.

avatar infograf768
infograf768 - comment - 10 Feb 2021

Adding indeed btn-group-yesno is much better

Screen Shot 2021-02-10 at 10 39 48

avatar infograf768
infograf768 - comment - 10 Feb 2021

@thednp
You should also consider adding a legend for a11y, as we have for the switcher.

Screen Shot 2021-02-10 at 10 34 01

avatar thednp
thednp - comment - 10 Feb 2021

Roger that, stay close for the updated layout.

avatar thednp
thednp - comment - 10 Feb 2021

Alright, I've changed in my dev so that this layout will do the following:

  • if you use class="btn-group" for any type="Radio" field, it should work as expected, which means the container of the input options will use class="btn-group", no change here
  • however, if you use class="btn-group-yesno" for type="Radio", it will also use .btn-group CSS class, because .btn-group-yesno" CSS class does not exist
  • so you don't have to use something like class="btn-group btn-group-yesno" for type="Radio" to achieve the same thing as I've showcased in the image attached above

Now about a11y, @infograf768 I don't see why a visible <label> need to have a legend for our buttons layout here.

avatar thednp thednp - change - 10 Feb 2021
Labels Added: ?
avatar thednp
thednp - comment - 10 Feb 2021

@infograf768 the switcher layout indeed is a special case, it needs to tell screen readers what's the option about since there is no visible <label>, only a hidden <legend> which I'm sure readers check.

You think we need to add <legend> for type="Radio" fields when using this very buttons layout?

avatar richard67
richard67 - comment - 10 Feb 2021

You think we need to add <legend> for type="Radio" fields when using this very buttons layout?

Maybe @chmst can have a look on that, too.

avatar richard67
richard67 - comment - 10 Feb 2021

I'm also not happy with the last change, that looks like a hack to me, that str_replace.

avatar chmst
chmst - comment - 10 Feb 2021

A legend is necessary (visually hidden).

avatar thednp
thednp - comment - 10 Feb 2021

@chmst I will add <legend> then, no problem.

@richard67 and @infograf768 you don't have to use class="btn-group btn-group-yesno", just class="btn-group-yesno", but if you REALLY think that's the way to do it, no problem, change incoming.

avatar infograf768
infograf768 - comment - 10 Feb 2021

but if you REALLY think that's the way to do it, no problem, change incoming.

It would be B/C with J3. As we have already so much non B/C in j4, let's not add one. ;)

avatar richard67
richard67 - comment - 10 Feb 2021

@richard67 and @infograf768 you don't have to use class="btn-group btn-group-yesno", just class="btn-group-yesno", but if you REALLY think that's the way to do it, no problem, change incoming.

@thednp Your str_replace would not be safe for the case someone uses a custom class like e.g. my-fancy-class-yesno for some reason. You should have done a regex replace to make sure you only replace what you want to replace ;-) But for B/C we should revert that completely, like @infograf768 said.

avatar thednp
thednp - comment - 10 Feb 2021

@chmst @infograf768 and @richard67 done.

See commit note.

avatar thednp thednp - change - 10 Feb 2021
Title
[4.0] Update buttons.php layout according to latest Bootstrap 5 markup
[4.0] Update buttons.php layout to latest Bootstrap 5 markup, also added LEGEND markup
avatar thednp thednp - edited - 10 Feb 2021
avatar infograf768
infograf768 - comment - 10 Feb 2021

The switcher__legend class exists in css, but not the radio__legend

avatar thednp
thednp - comment - 10 Feb 2021

Yes, the .radio__legend has just been created. But I was referring to the fact that the CSS for .switcher__legend is redundant, unless it serves a purpose for J3? I'm not sure.

avatar infograf768
infograf768 - comment - 10 Feb 2021

imho, switcher_legend css as well as radio-legend are totally useless as the only thing switcher_legend does is setting the font-size for a visually-hidden legend.
But let's @drmenzelit comment on that.

avatar ceford
ceford - comment - 10 Feb 2021

When I click the button it changes from disabled to enabled. But the two hidden checkboxes don't change checked status. I find this whole thing very confusing!


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

avatar thednp
thednp - comment - 10 Feb 2021

@ceford it's the same here, but it's OK, you can check the checked status via JavaScript, here's how:

  • open Inspector (assume you use a Chrome based browser)
  • right-click on an option, then select Inspect, make sure the <input> element is selected
  • in the browser console, type in $0.checked, it should return the current state

It's how the browser engine works now, it won't update the checked attribute, but internally it always knows the current state, as it renders your .btn elements properly according to the real checked state.

avatar infograf768
infograf768 - comment - 10 Feb 2021

Hmm, I now get
Screen Shot 2021-02-10 at 12 29 04

avatar richard67
richard67 - comment - 10 Feb 2021

Hmm, I now get ...

@infograf768 I guess you mean that space between the "No" and "Yes" buttons, right?

avatar thednp
thednp - comment - 10 Feb 2021

@infograf768 @richard67 that's what my previous fix was about. my implementation wasn't perfect as Rich pointed out, but would have solved that. So yea, you need to use class="btn-group btn-group-yesno" to have it working without spacing between.

avatar infograf768
infograf768 - comment - 10 Feb 2021

Forget it
Typo in the xml
I had class="btn-goup btn-group-yesno"

instead of
class="btn-group btn-group-yesno"

all ok

Screen Shot 2021-02-10 at 12 48 44

sorry

avatar richard67 richard67 - test_item - 10 Feb 2021 - Tested successfully
avatar richard67
richard67 - comment - 10 Feb 2021

I have tested this item successfully on 13fe5a0


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

avatar OctavianC OctavianC - test_item - 10 Feb 2021 - Tested successfully
avatar OctavianC
OctavianC - comment - 10 Feb 2021

I have tested this item successfully on 13fe5a0


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

avatar richard67 richard67 - change - 10 Feb 2021
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 10 Feb 2021

RTC


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

avatar brianteeman
brianteeman - comment - 10 Feb 2021

Not sure why this is RTC as there are outstanding issues. There is no point in adding a class to the legend that doesn't exist in the css. It serves no purpose as the legend is never visually displayed. Or do I miss something?

avatar richard67
richard67 - comment - 10 Feb 2021

Not sure why this is RTC as there are outstanding issues. There is no point in adding a class to the legend that doesn't exist in the css. It serves no purpose as the legend is never visually displayed. Or do I miss something?

We have such classes according to BEM elsewhere, too, as once added by @ciar4n , as far as I remember.

avatar brianteeman
brianteeman - comment - 10 Feb 2021

on something that is hidden? That makes zero sense.

avatar richard67
richard67 - comment - 10 Feb 2021

@thednp Could you remove the radio__legend from the class of the legend? Thanks in advance.

avatar richard67 richard67 - change - 10 Feb 2021
Status Ready to Commit Pending
avatar richard67
richard67 - comment - 10 Feb 2021

Back to pending.


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

avatar thednp
thednp - comment - 10 Feb 2021

@thednp Could you remove the radio__legend from the class of the legend? Thanks in advance.

Done.

avatar richard67 richard67 - test_item - 10 Feb 2021 - Tested successfully
avatar richard67
richard67 - comment - 10 Feb 2021

I have tested this item successfully on 9aabd48


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

avatar infograf768 infograf768 - test_item - 10 Feb 2021 - Tested successfully
avatar infograf768
infograf768 - comment - 10 Feb 2021

I have tested this item successfully on 9aabd48


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

avatar infograf768 infograf768 - change - 10 Feb 2021
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 10 Feb 2021

rtc
let’s get rid of switcher__legend code and css in another pr


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

avatar thednp
thednp - comment - 10 Feb 2021

@infograf768 I would do it rn if I knew where's the source.

avatar richard67
richard67 - comment - 10 Feb 2021

@thednp find ./ -type f -exec grep -Hn "switcher__legend" {} \; in a Linux shell or findstr /s /c:"switcher__legend" *.* in a Windows Command window will help you to find out when executed in the Joomla root folder.

avatar richard67
richard67 - comment - 10 Feb 2021

But for SCSS sources in the build folder it needs a git clone of course, that's not included in a normal installation package.

avatar thednp
thednp - comment - 10 Feb 2021

Added #32377 in regards to #issuecomment-776805109

avatar thednp
thednp - comment - 10 Feb 2021

Boy I wish we had the same involvement for #30816

avatar infograf768 infograf768 - close - 11 Feb 2021
avatar infograf768 infograf768 - merge - 11 Feb 2021
avatar infograf768 infograf768 - change - 11 Feb 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-02-11 07:12:09
Closed_By infograf768
Labels Added: ?
avatar infograf768
infograf768 - comment - 11 Feb 2021

Tks

Add a Comment

Login with GitHub to post a comment