? Pending

User tests: Successful: Unsuccessful:

avatar demis-palma
demis-palma
28 Mar 2017

Chosen dropdown provides 2 ways to set the width of the dropdown element:

  1. Specify it as inline style in the select element (<select style="width: 500px;" ...) or
  2. Specify it as an option for the chosen() function (width: '600px')
    See related documentation.

The new style introduced in the Isis template forces the width to a different value (which also causes a horizontal collapse in case of blank items).

There is no reasonable way for third party extensions developers to specify a custom with for their own dropdown elements.

To fix this problem, I've removed two css lines that in principle, we should not use anyway, since the chosen dropdown control offers other ways to set its width.

However it's possible that @ciar4n remembers the reason for these lines and can help us by providing further details.

Testing Instructions

Create a select anywhere in the back-end

<?php
JFactory::getDocument()->addStyleSheet(JUri::root(true) . "/media/jui/css/chosen.css");
JFactory::getDocument()->addScript(JUri::root(true) . "/media/jui/js/chosen.jquery.js");

<div class="control-group">
	<select style="width: 500px;" class="chosenize">
		<option>Option</option>
	</select>
</div>

Pay attention to encase it in a "control-group" wrapper as shown, since the issue only affects dropdown elements within a "control-group" wrapper.
Also pay attention to the class assigned (in this case "chosenize"), which must correspond to that used in the following JavaScript.

Run the following JavaScript to transform the select into a chosen dropdown:

jQuery(document).ready(function ($)
{
	// 600px overrides the value of 500px specified in the PHP code
	$('.chosenize').chosen({ width: '600px' });
});

Expected result

I expect the dropdown was 500 or 600 px wide, with the precedence to the value specified in the JavaScript.

Actual result

The dropdown is 220 px wide.

avatar demis-palma demis-palma - open - 28 Mar 2017
avatar demis-palma demis-palma - change - 28 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Mar 2017
Category Administration Templates (admin)
avatar brianteeman
brianteeman - comment - 28 Mar 2017

please dont directly edit any css files. You should make the edit in the respective less file and then run generatecess.php from the /build folder

avatar demis-palma
demis-palma - comment - 28 Mar 2017

Thanks.
That explains the warning I saw: "Can't merge it automatically".

avatar brianteeman
brianteeman - comment - 28 Mar 2017

The warning because you had conflicts - probably not related to not generating the less file

avatar demis-palma
demis-palma - comment - 28 Mar 2017

Brian, please bear with me. Should I also include the regenerated .css file in my PR, or should I limit the commit to the .less file?

avatar brianteeman
brianteeman - comment - 28 Mar 2017

the PR should include the less file and any generated css files. Remember it might generate more than you expect

avatar demis-palma
demis-palma - comment - 28 Mar 2017

Thanks.

avatar demis-palma demis-palma - change - 28 Mar 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-03-28 16:58:19
Closed_By demis-palma
Labels Added: ?
avatar demis-palma demis-palma - close - 28 Mar 2017

Add a Comment

Login with GitHub to post a comment