Skip to content
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

[UX] Provide a hint that classes can be added to the inner wrapper of a region. #3075

Closed
klonos opened this issue May 2, 2018 · 4 comments
Closed

Comments

@klonos
Copy link
Member

klonos commented May 2, 2018

I have noticed this small UX problem while posting a comment in #682 (comment) ...

So by default, when one clicks the "Configure region" option of any region in the "Manage blocks" page:

screen shot 2018-05-03 at 4 09 42 am

...they see this:

screen shot 2018-05-03 at 4 11 16 am

What is not clear, is that if you select any option other than the default "no inner wrapper", you get a "CSS classes for inner wrapper" field, that allows you to add classes:

screen shot 2018-05-03 at 4 12 40 am

This is a very useful feature, but we are hiding it away from the user. I see 2 options that would help improve the situation:

  1. Add some help text while the select option in the dropdown is "no inner wrapper". Something very simple like:

    Selecting an inner wrapper would allow you to specify custom classes for it, which you can then use to help you theme your site.

    Here's how this would look:

    screen shot 2018-05-03 at 4 29 43 am

  2. "CSS classes for inner wrapper" field be rendered all the time, instead of being hidden via #states, but have it be disabled (with an explanation as to why), until the user has selected an option other than "no inner wrapper". Something like this:

    screen shot 2018-05-03 at 4 47 16 am

Thoughts?


PR by @klonos: backdrop/backdrop#2527

@klonos
Copy link
Member Author

klonos commented May 2, 2018

...I personally like the 2nd option, because... nobody reads help text unfortunately 😞

@quicksketch
Copy link
Member

Yeah second option is better. We can use #states to set enabled/disabled, but it doesn't have the ability to directly set description text. We could hide/show description text by making it a separate element, but it wouldn't be pretty, either in markup or in the UI due to extra margins. Though we could perhaps use a description like "If an inner wrapper is added, specify classes separated by spaces."

@klonos
Copy link
Member Author

klonos commented Mar 9, 2019

So yeah, turns out that '#type' => 'help' does not support #states or #attributes (or if meant to, then it doesn't work: #3569). So this does not work:

  $form['help'] = array(
    '#type' => 'help',
    '#markup' => t('Separate multiple classes with spaces.'),
    '#attributes' => array('class' => array('description')),
    '#states' => array(
      'invisible' => array(
        ':input[name="element"]' => array('value' => ''),
      ),
    ),
  );

...in that the class is not added, and the #states functionality never kicks in.

Anyway, I went with what @quicksketch has suggested for the help text, which is a much simpler change too. Not perfect/ideal, but solves the UX/discoverability issue at hand:

Screen Shot 2019-03-09 at 8 41 59 pm

Suggesting 1.12.4 milestone.

@quicksketch
Copy link
Member

Merged backdrop/backdrop#2527 into 1.x and 1.12.x. Thanks @klonos and @herbdool!

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

3 participants