?
avatar N6REJ
N6REJ
1 May 2017

Steps to reproduce the issue

Create field like
<field name="mainmenuitemSpacing" default="" type="text" size="4" filter="int" class="small-input" showon="extendedmainmenuParams:1" label="TPL_SERENITY_MAINMENU_ITEM_SPACING_LABEL" description="TPL_SERENITY_MAINMENU_ITEM_SPACING_DESC" > </field>
check width of text box.

Expected result

width of box is the size of font in characters

Actual result

size is fixed.
image

System information (as much as possible)

J! 3.7

Additional comments

I suspect it happen irregardless of if in repeatable form field which my test was.

avatar N6REJ N6REJ - open - 1 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 1 May 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 May 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 May 2017
Category Fields
avatar Bakual
Bakual - comment - 2 May 2017

The width of input elements is "hardcoded" by CSS rules. I think it is this rule:

// Reset appearance properties for textual inputs and textarea
// Declare width for legacy (can't be on input[type=*] selectors or it's too specific)
input,
textarea,
.uneditable-input {
  width: 206px; // plus 12px padding and 2px border
}

https://github.com/joomla/joomla-cms/blob/staging/media/jui/less/forms.less#L92-L98

avatar ggppdk
ggppdk - comment - 2 May 2017

Browsers will first use CSS rules to decide width of field
and then if none CSS rule is found to effect the field's width
only then the size parameter will be used to calculate the width of the field

only an inline CSS rule like the following (i have not tested) could do the trick
.... 'width: ' . $size . 'em;'

but it is wrong to do for all text fields thus overriding the template's CSS,
maybe adding a parameter "enforce size width" is a solution

avatar franz-wohlkoenig franz-wohlkoenig - change - 2 May 2017
Status New Discussion
avatar brianteeman brianteeman - change - 9 Sep 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-09-09 12:41:34
Closed_By brianteeman
avatar brianteeman brianteeman - close - 9 Sep 2017
avatar brianteeman
brianteeman - comment - 9 Sep 2017

Closed as expected behaviour

avatar N6REJ
N6REJ - comment - 9 Sep 2017

@brianteeman how can you say "expected behavior" when we have a parameter in the form field system that is SPECIFICALLY for specifying size?
EVEN if you said, well we've hard coded the size into .css then it STILL is a bug as it's not following the DESIGN of the form field system by not honoring the param so therefore the param needs to be removed,
No matter how you slice it you shouldn't have closed this.
https://docs.joomla.org/Special:MyLanguage/Text_form_field_type

avatar ggppdk
ggppdk - comment - 9 Sep 2017

I think this is a proper way to fix this

since the width parameter has the effect to add:
size="40"

making it also add (i have not tested, it should work, it will be a little off depending on box-sizing setting in effect but this is close enough)
size="40" style="... ; width: 40em;"

should not be bad choice
it would be doing what the user asked for

avatar N6REJ
N6REJ - comment - 9 Sep 2017

@ggppdk I think your on the right track.. I believe we need to pull the parm and then either do css calc or calc in php using $width = $this->get(param) . ".ch" or possibly ".pt" but I think its ch

avatar ggppdk
ggppdk - comment - 9 Sep 2017

This would be really useful to add

Closed as expected behaviour

@brianteeman it is expected behaviour
in terms that the parameter is meant to add size="..."
and it does add it,
and then CSS has higher priority

but this is looks like worthile making it better and enforcing an inline width CSS style for the text field, to achieve what the user needs for the specific field

avatar ramblerswebs
ramblerswebs - comment - 6 Mar 2019

I don't see this should be closed
I have <field name="ListFormat" type="text" default="" size="600" label="List layout format" description="List layout format" />

and am using J3.9.3 and I get a text box of 206 wide when I need more (perhaps not 600)
why have an option if it DOES NOT WORK

avatar N6REJ
N6REJ - comment - 13 May 2019

@frankmayer reopen this please

avatar franz-wohlkoenig franz-wohlkoenig - change - 13 May 2019
Status Closed New
Closed_Date 2017-09-09 12:41:34
Closed_By brianteeman
avatar franz-wohlkoenig franz-wohlkoenig - reopen - 13 May 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 13 May 2019
Status New Discussion
avatar HLeithner
HLeithner - comment - 13 May 2019

We can't fix this i the xml because it's not the right place to add styling, the only thing you can do is to add a custom "class" and add css to the template. Even if we add a "style" attribute to the xml tag it would be the wrong approach because we shouldn't do any styling in the form xml.

avatar HLeithner HLeithner - close - 13 May 2019
avatar HLeithner HLeithner - change - 13 May 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-05-13 09:05:46
Closed_By HLeithner
avatar ReLater
ReLater - comment - 13 May 2019

For mod_search we are using this code:
6160e39#diff-602b029403197b38b1471bf1c6b6c1cd

Means: ressetting the width style with auto using a bad inline style.

I don't think that it's worth to implement things like that. See comment #15727 (comment) (custom class)

avatar Bakual
Bakual - comment - 13 May 2019

Best would be to actually remove the size attribute fromt he XML. As nowadays things like size should be done with CSS. Especially since size isn't reliable anyway.

avatar HLeithner
HLeithner - comment - 13 May 2019

@Bakual would you like to make a pr for j5?

avatar ramblerswebs
ramblerswebs - comment - 13 May 2019

I don't understand all these comments. If I remove the lines
input,
textarea,
.uneditable-input {
xxwidth: 206px;
}
lines 912 onwards from administrator/templates/isis/css/template.css then the input field display to what look like the correct width

avatar Bakual
Bakual - comment - 13 May 2019

@ramblerswebs The point is: It's correct that the CSS specifies the width, as it is a design question which is in the responsibility of the template. So the CSS is fine, and naturally the size attribute is ignored.

@HLeithner I wasn't aware we're already doing PRs for J5 ?

avatar HLeithner
HLeithner - comment - 14 May 2019

@HLeithner I wasn't aware we're already doing PRs for J5

iirc there shouldn't be no "big" deprecation in j3.10 for 4.0 so changes is is only possible in j5

avatar Bakual
Bakual - comment - 14 May 2019

Agreed. But I don't think I will remember this here when we start the J5 branch. So don't count on me.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 14 May 2019

@Bakual makes a "J5"-Label sense?

avatar Bakual
Bakual - comment - 14 May 2019

It may be. Lets ask @wilsonge what his thoughts are about adding issues to the backlog for J5 already :)

Add a Comment

Login with GitHub to post a comment