Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Use an horizontal rule to separate preferred choices #52260

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

Closed
javiereguiluz opened this issue Oct 24, 2023 · 6 comments
Closed

[Form] Use an horizontal rule to separate preferred choices #52260

javiereguiluz opened this issue Oct 24, 2023 · 6 comments

Comments

@javiereguiluz
Copy link
Member

javiereguiluz commented Oct 24, 2023

Description

Today, we use by default the following text-based separator for preferred choices in ChoiceType:

'separator' => '-------------------',

Some browsers just added support for adding <hr> as separators inside <select> elements, which looks much better. See https://developer.chrome.com/blog/hr-in-select/

If this proposal is accepted, it can only be implemented in a few months, when most browsers support this feature. Thanks!

@xabbuh
Copy link
Member

xabbuh commented Oct 24, 2023

πŸ‘ sounds good to me

@stof
Copy link
Member

stof commented Oct 24, 2023

Already supported in Safari and now in Chrome. We're just missing Firefox there.

Note that we might need to make this configurable at first, as some projects might need to keep support for older browsers or they might do custom things with the separator.

@stof
Copy link
Member

stof commented Oct 24, 2023

For reference, here is the ticket tracking this for Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1830909

@javiereguiluz
Copy link
Member Author

javiereguiluz commented Dec 27, 2023

This has been implemented in Firefox πŸŽ‰

It's available in the nightly release. See https://www.mozilla.org/en-US/firefox/122.0a1/releasenotes/ and will land in the next 122 stable release.

nicolas-grekas added a commit that referenced this issue Jan 9, 2024
… custom separator after preferred choices (mboultoureau)

This PR was squashed before being merged into the 7.1 branch.

Discussion
----------

[Form] Add option `separator` to `ChoiceType` to use a custom separator after preferred choices

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Linked with #52260
| License       | MIT

Add `separator_html` option to display the `separator` text as HTML

Commits
-------

bde5191 [Form] Add option `separator` to `ChoiceType` to use a custom separator after preferred choices
@nicolas-grekas
Copy link
Member

Another option would be to use a unicode character to make a line (─ => ──────)
Both options (html / unicode) are doable in userland after #52447, but do we want to change the default?
PR welcome if yes. Can be closed otherwise.

@xabbuh
Copy link
Member

xabbuh commented Jan 9, 2024

I would not make the change by default to not break existing applications (or at least their tests). Being able to customise this is sufficient to me.

@xabbuh xabbuh closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants