Problem/Motivation

Radios

Note: top is on Mac OS X/Chrome and bottom is on Mac OS X/Firefox (on larger screens). If I squish the Firefox window to smaller width -> the QEON radio button becomes visible.

Steps to reproduce

Install Webform module -> then add Element of type radios:

  area:
    '#type': radios
    '#title': Area
    '#options':
      1: AB/NWT
      2: AC
      3: BC/Y
      4: CSO
      5: QEON
      6: MB/SK/WO
    '#options_display': three_columns
    '#required': true

Documenting this here. Happy to provide more info and/or test possible patches. I'm seeing this on 9.1.x - I'll bump another site to 9.2.x to see if the issue is present there.

Issue fork drupal-3225138

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

KarinG created an issue. See original summary.

karing’s picture

StatusFileSize
new309.79 KB

Radios in 9.2.2

It looks better in 9.2.2 -> but it's still very squished and the top of the radio is chopped off. If we remove the display: inline as highlighted here in this image it looks great on both Firefox and Chrome!

Only local images are allowed.

andy-blum’s picture

I'm not able to replicate this issue on mac OSX in chrome or safari with 9.3.x at any zoom level.

Can you try using the latest development branch and see if the problem still occurs?

karing’s picture

Hi Andy, if I look at your screenshots (e.g. the third one you uploaded - ending in 4.14.55) -> the radios are very tight and are overlapping/cut off when selected: let me embed it here:

Radio selected

PS -> if you remove display: inline -> I think you'll find the radios to be spaced better vertically [perhaps a bit too much line height - but no more cut offs]

mherchel’s picture

Priority: Normal » Minor

Haven't tested it out, but I wonder what styles are applying if display inline is not set.

I do agree that we could use some vertical padding to allow space for the offset outline.

xjm’s picture

Priority: Minor » Normal

Hm, not sure what to think about this one. On the one hand, modules like Webform should make sure they work with Olivero, at least once it becomes the core theme. On the other, though, the screenshot where the radio button disappears is really bad; that would be a major bug.

@KarinG Does this happen in Bartik?

Splitting the difference at "Normal" for now.

karing’s picture

@xjm -> here's Olivero (top) and Bartik (bottom). Olivero looks WAYYYYY better - even with the radio buttons a bit crowded and slightly overlapping.

Bartik comparison

aaron.ferris’s picture

This is defined in the webform css in webform.element.options.css

/**
 * Display columns for devices that are more than 400px wide.
 */
@media (min-width: 400px) {
  .webform-options-display-two-columns {
    display: block;
    max-width: 900px;
    margin-top: 0.4em;
    column-count: 2;
  }

  .webform-options-display-three-columns {
    display: block;
    max-width: 900px;
    margin-top: 0.4em;
    column-count: 3;
  }

  .webform-options-display-two-columns div.form-item,
  .webform-options-display-three-columns div.form-item {
    margin-top: 0;
    margin-bottom: 0;
  }
}

In particular

  .webform-options-display-two-columns div.form-item,
  .webform-options-display-three-columns div.form-item {
    margin-top: 0;
    margin-bottom: 0;
  }

However, this is mainly becoming a problem because of the additional styling around radios that we have in Olivero.

I'm also seeing the focus state with a cropped border radius (on radios other than the first child), some padding top and bottom might solve both problems.

aaron.ferris’s picture

Something like the attached which seems to solve this particular use case.

It does feel a bit weird to be using webform specific classes (and breakpoint!) in Olivero however

Edit: its worth noting I cannot recreate all the issues from the original post (such as parts of the radio button appearing in the wrong column)

aaron.ferris’s picture

Status: Active » Needs review
kostyashupenko’s picture

Status: Needs review » Needs work

@aaron.ferris i think it's wrong idea to write styles for webform's based selectors inside of Olivero, because webform module is a contrib module. Olivero theme can't and shouldn't fit all contrib modules. Here is reversed logic -> contrib modules should make sure they work fine with Olivero.

But still, maybe somehow possible to fix described issue from Olivero theme without references to webform module, i dont know.

My initial thoughts are the following:
1. If described problem happens really often to several contrib modules / cases not related to drupal core -> maybe then we can write a little bit more styles inside of Olivero to fit all those. A little bit more styles means additional styles, which will overlap module's styles so we will never meet described problem, because it can be universally fixed from Olivero theme.
2. If problem happens only to Webform module and nowhere else -> for sure better check webform module and provide fix from there, instead of touching Olivero.

aaron.ferris’s picture

I don't think it's possible to avoid the webform specific classes, the issue arrives when radios are stacked into webform columns (possibly any column?). I believe radios by default are stacked into rows, at least from my limited testing anyway.

Agreed however it feels weird for webform references in Olivero, I indicated as such in my comment.

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.

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.

pradipmodh13’s picture

StatusFileSize
new214.03 KB
new572.07 KB
new530.07 KB

Hello, @kostyashupenko.
You are correct. The gap between two radio buttons works great with a single column, however when we set two, three, or five columns, the spacing is removed by webform CSS.
We can get our layout space and active radio button will not overlap by eliminating margin-bottom css.
So we should edit webform CSS rather than the olivero theme file.
Please see the following screenshot for reference.

@all
Please suggest me how can I submit the patch of webform contrib module. ?

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

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Nishant2312 made their first commit to this issue’s fork.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.