Problem/Motivation

At narrower screen widths, select fields can disappear in Claro theme. Example:

Visible values at average width:

At a narrow width, the select element is too narrow and the values are hidden:

Steps to reproduce

  1. Make Claro the admin theme
  2. Go to an admin page that has select form fields such as manage fields or manage display
  3. Make the browser window so narrow the select values are hidden
  4. Expected result: select values are shown even at narrow screen widths

Proposed resolution

Update the CSS to ensure select fields are always visible in forms by adding a horizontal scroll.

Remaining tasks

  • Create patch
  • Review patch
  • Test patch
  • Commit

User interface changes

Select form field values will be shown at narrower screen widths, with a horizontal scroll.

Screenshots after patch:

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#55 interdiff-d9-d10.txt1.49 KBsrishtiiee
#55 3159896-10.1.x-55.patch1.18 KBsrishtiiee
#55 3159896-9.x-55.patch1.55 KBsrishtiiee
#49 3159896-after-patch.mov1.49 MBnayana_mvr
#49 3159896-before-patch.png121.83 KBnayana_mvr
#47 Screen Shot 2023-01-27 at 10.19.41 am.png71.94 KBpameeela
#47 Screen Shot 2023-01-27 at 10.18.56 am.png106.93 KBpameeela
#46 3159896-46.patch1.55 KB_utsavsharma
#46 interdiff_32-46.txt1.75 KB_utsavsharma
#42 screenshot-14877832-tested.png63.3 KBguru2023
#34 Select field - after patch.png89.09 KBdeepalij
#34 Select field - before patch.png93.88 KBdeepalij
#32 interdiff-15_32.txt1.58 KBgauravvvv
#32 3159896-32.patch1.49 KBgauravvvv
#31 Screen Shot 2023-01-10 at 14.29.07.png38.83 KBlauriii
#19 Screenshot 2022-02-21 at 10.40.48 AM.png97.87 KBSatyajit1990
#19 Screenshot 2022-02-21 at 9.16.20 AM.png395.13 KBSatyajit1990
#15 3159896-9-4.x-fix-custom-command.patch1.26 KBawset
#12 3159896-9-4.x-fix-custom-command.diff1.26 KBawset
#11 3159896-new-patch.png333.85 KBawset
#11 3159896-9-4.x-css-fixes.patch1.26 KBawset
#11 3159896-patch-9.png382.46 KBawset
#10 afterpatchD9.png17.73 KBakhildev.cs
#10 beforepatch9.png21.9 KBakhildev.cs
#9 3159896-9.4.x-9.patch1.4 KBmherchel
#9 3159896-10.0.x-9.patch961 bytesmherchel
#8 Screen Shot 2022-01-25 at 11.25.58.png18.03 KBlauriii
#7 3159896-10.0.patch922 bytesmherchel
#7 3159896-9.4.patch1.19 KBmherchel
#3 Screen Shot 2020-07-20 at 15.40.05.png48.89 KBlauriii
select-word-erasure.png50.8 KBbnjmnm
select-visible-words.png81.1 KBbnjmnm

Issue fork drupal-3159896

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bnjmnm created an issue. See original summary.

lauriii’s picture

Issue tags: +Accessibility, +Usability
lauriii’s picture

StatusFileSize
new48.89 KB

Similar bug seems to exist in Seven:

Based on some quick testing, it seems like this is caused by width: 100%. It seems like something that should not probably be set for select elements. It also seems like we might want to consider removing width: 100% from any type of form element that is rendered inside a table.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mherchel’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB
new922 bytes

Patch attached for both 9.4.x and 10.0.x.

My approach is to use the @supports syntax for 9.4.x. So the IE experience won't have the <select> elements stretch to their containers in IE. IMHO, that's fine.

It does make the table larger than the container, but tables are really horrible for mobile anyway, so that's a larger issue.

lauriii’s picture

Status: Needs review » Needs work
StatusFileSize
new18.03 KB

This seems like a nice improvement. However, it seems like in Safari and Firefox, the <td> doesn't resize according to the <select> width:

mherchel’s picture

Status: Needs work » Needs review
StatusFileSize
new961 bytes
new1.4 KB

🤦‍♂️Safari.

The new patches fix that issue. Tested on Chrome, Safari, and Firefox.

akhildev.cs’s picture

StatusFileSize
new21.9 KB
new17.73 KB

HI, patch #9 working fine for me,
It solves the "select element out of visibility issue on narrow widths".
(tested with: drupal-9.4.x-dev. Theme: claro).

awset’s picture

StatusFileSize
new382.46 KB
new1.26 KB
new333.85 KB

it seems the last patch (#9) were compiled incorrectly in D9. see 3159896-patch-9.png

So I modified the patch, and it is now compiled properly. see 3159896-9-4.x-css-fixes.patch

with the Drupal 10 patch, it works fine.

awset’s picture

StatusFileSize
new1.26 KB

fix the patch as the last one failed the test.

kristen pol’s picture

Thanks @awangsetyawan. Please make sure to add an "interdiff" when modifying patches:

https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa...

so that people can easily see what was changed between the old and new patch.

Also, it's customary to upload a `.patch` file rather than a `.diff` file. Thanks.

kristen pol’s picture

Issue tags: +Needs manual testing

Looking at #12 vs #9, I do see that some extra CSS was removed which seems correct:

Old:

+td > .form-item > .form-element,
+td > .ajax-new-content > .form-item > .form-element {
+    td > .form-item > .form-element,
+    td > .ajax-new-content > .form-item > .form-element {

New:

+td > .form-item > .form-element,
+td > .ajax-new-content > .form-item > .form-element {

and added a missing semi-colon.

So, I'm confused how it worked in #10.

This needs testing on:

  1. 9.4 - Chrome
  2. 9.4 - Firefox
  3. 9.4 - Safari
  4. 10.0 - Chrome
  5. 10.0 - Firefox
  6. 10.0 - Safari
awset’s picture

StatusFileSize
new1.26 KB

The patch file in #12 is ending with .diff, re-uploading with .patch file. Apologies with this inconvenient.

kristen pol’s picture

Thanks @awangsetyawan. I checked and see that the patches in #12 and #15 are the same except for the file extensions.

This still needs manual testing.

kristen pol’s picture

Title: Value of select elements can wind up hidden at narrow widths. » Select form field values are hidden at narrow screen widths in Claro theme
Issue summary: View changes

Updating title and issue summary to clarify the issue a bit and add some general steps to reproduce.

kristen pol’s picture

Issue summary: View changes

One more tweak :)

Satyajit1990’s picture

Testing Steps :
1. Go to Appearance -> Verify the Claro theme is selected
2. Go to https://8080-shaal-drupalpod-wctq62a5ocf.ws-us33.gitpod.io/en/admin/stru... (Home>Administration>Structure>Content types>Article
3. Now right click and inspect the element and verify the UI of Select form field values are hidden at narrow screen widths

Note : I have verified in
Expected Results: Select form field values should display at narrow screen widths

Actual Results: Select form field values should display at narrow screen widths

Please refer the screenshot below attached in the file :
Screenshot 2022-02-21 at 9.16.20 AM.png
Screenshot 2022-02-21 at 10.40.48 AM.png

kristen pol’s picture

Thanks @Satyajit1990. Are you sure you were testing with a narrow width? You should be able to see the whole table at that width and it doesn't look like in your screenshot (there is stuff outside the viewport).

kristen pol’s picture

Now I'm wondering if you are experiencing this issue with mobile tables so I'm a bit confused: #3068696: Tables overflow on mobile

kristen pol’s picture

Seems to be a duplicate of #3135457: Select widths not taken into account when table is rendered but I haven't compared the patches.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

aslaymoore’s picture

I tested the patch mentioned in #22 and it only corrected select items. #15, however corrected fixed the issue for text input fields as well (which was the issue I was experiencing when attempting to set row weights). Tested on 9.4.8 (Claro admin theme).

+1 for RTBTC

aslaymoore’s picture

Status: Needs review » Reviewed & tested by the community

Updating status to RTBTC (missed that step in the last comment, sorry)

mherchel’s picture

Re-queued tests for two patches:

  • My D10 patch from #9
  • @awset's D9 patch from #15

lauriii’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
StatusFileSize
new38.83 KB

This causes a regression for field cardinality which is also rendered in table. Previously the textfield would scale to the width of the screen but now the fields are adding horizontal scroll and do not scale as browser is resized.

Closing #3135457: Select widths not taken into account when table is rendered as a duplicate of this issue.

gauravvvv’s picture

StatusFileSize
new1.49 KB
new1.58 KB

Updated the code for select field only, Attache interdiff with #15. please review

gauravvvv’s picture

Status: Needs work » Needs review
deepalij’s picture

StatusFileSize
new93.88 KB
new89.09 KB

Able to reproduce the issue using the steps in the IS.
Applied patch #32 on drupal 10.1.x-dev
The patch applied cleanly

The select field width issue on the narrow screen has been resolved after applying the patch.
But can see a horizontal scroll.

Refer to the attached screenshots
Before patch:
before

After patch:
after

pameeela credited moonpeak.

pameeela credited snte.

pameeela’s picture

guru2023’s picture

Assigned: Unassigned » guru2023

I will double check this patch and update here

guru2023’s picture

Assigned: guru2023 » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new63.3 KB

Patch is tested and it is working fine on mobile device or narrow screens.

mgifford’s picture

Issue tags: +wcag1410

Looking forward to seeing this fixed.

pameeela’s picture

Sorry for the noise, I realised this isn't actually a duplicate because it only addresses Claro. The comment with screenshots from Seven made me think it would be addressed more widely but I saw the patch is just for Claro! So removing the credits and I will re-open the other issue.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

I like that this is now only targeting the select because that makes this less likely to run into problems.

+++ b/core/themes/claro/css/components/tables.pcss.css
@@ -172,6 +172,19 @@ td > .ajax-new-content > .form-item > .form-element {
+td > .form-item > select.form-element,
+td > .ajax-new-content > .form-item > select.form-element {
...
+  td > .form-item > select.form-element,
+  td > .ajax-new-content > .form-item > select.form-element {

Instead of select.form-element, we could use .form-element--type-select as the selector.

_utsavsharma’s picture

StatusFileSize
new1.75 KB
new1.55 KB

Addresses the point from #45.
Please review.

pameeela’s picture

Screenshots from latest patch:

pameeela’s picture

Status: Needs work » Needs review
nayana_mvr’s picture

StatusFileSize
new121.83 KB
new1.49 MB

Verified the patch #46 and tested it on Drupal version 10.1.x. The issue seems to be fixed after applying the patch. The select form fields are now visible and the user can scroll horizontally to view all the fields and settings section. I have added the before patch screenshot and after patch screen recording for reference. RTBC+1

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Can the before/after screenshots be added to the issue summary. To show this is fixed.

Also the proposed solution is a bit vague. How is it being fixed? From what I can tell it adds a horizontal scroll is that the desired solution?

pameeela’s picture

pameeela’s picture

Issue summary: View changes
Status: Needs work » Needs review
Related issues: +#3068696: Tables overflow on mobile

Added #3068696: Tables overflow on mobile as related. To answer @smustgrave I think the horizontal scroll is the only way to fix this particular issue without some other, major changes to responsive tables, which are out of scope for this issue.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

In that case looks good thanks for the quick response!

bnjmnm’s picture

Status: Reviewed & tested by the community » Needs work

#46 is a 9.x patch, but we need a 10.x patch since all 10.x browsers support (min-width: max-content) so that condition isn't needed or the styles just above it that provide defaults for non-max-content browsers. #9 has a good example of how the patches can be named to be easy to identify.

srishtiiee’s picture

StatusFileSize
new1.55 KB
new1.18 KB
new1.49 KB
srishtiiee’s picture

Status: Needs work » Needs review

Posted separate patches for 9.x and 10.x

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

#55 appears to address $54

  • lauriii committed ad02e3e8 on 10.1.x
    Issue #3159896 by mherchel, awset, srishtiiee, Gauravvvv, _utsavsharma,...

  • lauriii committed a48e3346 on 10.0.x
    Issue #3159896 by mherchel, awset, srishtiiee, Gauravvvv, _utsavsharma,...

  • lauriii committed 521f0bf2 on 9.5.x
    Issue #3159896 by mherchel, awset, srishtiiee, Gauravvvv, _utsavsharma,...
lauriii’s picture

Version: 10.1.x-dev » 9.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed ad02e3e and pushed to 10.1.x. Thanks! Cherry-picked to 10.0.x and committed to 9.5.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.