-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Cosmetic fix: Removed unnecessary attribute with default value from template #6153
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
Conversation
@bschussek any objections? Do you remember why it was done this way? |
@bschussek ping =) (I can fix tests if you accept this =)) |
The problem here is when you use text widgets. These will be too wide unless you style them specifically. What about passing "size" only if |
That indeed seems to be the solution. I didn't realize that "size" differs for the select and input tag:
Could you please adapt the PR? |
Shouldn't the size then be "2" for text-widgets? Otherwise there is not enough space for two-digit hours, minutes or seconds. |
@mweimerskirch In theory yes, but in practice I found fields to be much wider than that. "1" was the value at which the field had the best look&feel. |
IMO this is wrong that we force developers now to have defined look&feel, styling of fields etc., this should be always left for developers without forcing them to overwrite template block to simply (in this case) remove |
I tend to agree with @stloyd. However, this pull request is marked for 2.1. I feel that removing the size-attribute entirely might be a "compatibility" break. I've changed the pull request to keep the size-attribute for the text widget, while removing it for select widget. If it is to be removed entirely, I can create a second pull request for master. |
@stloyd But we want to have a reasonable default, right? So far at least noone else complained. Furthermore, We can of course make the additional improvement by doing someting like
Then the user can overwrite the size if required also via Twig if he prefers that over CSS. |
@bschussek: I don't see why to make this configurable. This would tempt devs to use an HTML attribute for styling instead of CSS. IMHO the size=1 should be kept in sf 2.1 for the text widgets (but removed for the select) in order to prevent existing apps from breaking (as in this patch). |
This PR was merged into the 2.1 branch. Commits ------- b7bd630 [Form] Fixed TimeType not to render a "size" attribute in select tags Discussion ---------- [Form] Fixed TimeType not to render a "size" attribute in select tags | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #6153 | License | MIT | Doc PR | -
… >= 3 (Staormin) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [String] Add conflict with symfony/translation-contracts >= 3 | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Got the following issue this morning in symfony 5.4-RC1 with php 8.1: ``` !! !! Fatal error: Declaration of Symfony\Component\String\Slugger\AsciiSlugger::getLocale() must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::getLocale(): string in /opt/project/vendor/symfony/string/Slugger/AsciiSlugger.php on line 93 !! Symfony\Component\ErrorHandler\Error\FatalError {#6153 !! #message: "Compile Error: Declaration of Symfony\Component\String\Slugger\AsciiSlugger::getLocale() must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::getLocale(): string" !! #code: 0 !! #file: "./vendor/symfony/string/Slugger/AsciiSlugger.php" !! #line: 93 !! -error: array:4 [ !! "type" => 64 !! "message" => "Declaration of Symfony\Component\String\Slugger\AsciiSlugger::getLocale() must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::getLocale(): string" !! "file" => "/opt/project/vendor/symfony/string/Slugger/AsciiSlugger.php" !! "line" => 93 !! ] !! } !! ``` This PR fixed the error on my side. Commits ------- 3b61236 [String] Add conflict with symfony/translation-contracts >= 3
"1" is the default value of the "size" attribute for the "select" tag, so it is not necessary (=no backwards compatibility break).
Applying this patch makes it easier to work with bootstrap, because bootstrap includes a selector that checks it the "size" attribute is present: https://github.com/twitter/bootstrap/blob/master/less/forms.less#L172
I noticed the problem when working with the Sonata AdminBundle:
Before this patch:

After this patch:

The date and time fields in Sonata were not aligned because the CSS code between date and time fields was different (the size attribute was not present on date fields, only on time fields, so different CSS code was applied).