hide button "SUBMIT" in currency block selector

Created on 21 June 2020, over 4 years ago
Updated 27 May 2024, 6 months ago

The currency selector works perfect without pressing any button, so it is highly desirable to add an option to make the button "SUBMIT" hidden or otherwise to remove the button.

πŸ’¬ Support request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom londova

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΎUruguay fanton Uruguay

    Hiding the button from CSS or removing it would cause accessibility rule validation issues (SC 3.2.2: The submit button is missing). To avoid that, the correct way is to hide it visually:

    In MYTHEME.theme:

    <?php
    use Drupal\Core\Form\FormStateInterface;
    
    /**
     * Implements hook_form_alter().
     */
    function MYTHEME_form_alter(&$form, FormStateInterface $form_state, $form_id) {
      if ($form_id == 'commerce_currency_resolver_select_form') {
        $form['submit']['#attributes']['class'][] = 'visually-hidden';
      }
    }
    ?>
    
    
  • πŸ‡¨πŸ‡³China hongqing

    It could be hided with css, for example:

    .topbar-currency-region .commerce-currency-resolver-select-form .button {
        display: none;
    }
Production build 0.71.5 2024