skip to Main Content

I have a web application with checkboxes that I want to universally disable using CSS, regardless of the language displayed on the page. I initially used the following CSS to disable checkboxes with specific aria-label attributes, but it does not work for all languages:

label[aria-label="Select All"] {
  display: none;
  pointer-events: none;
}

I want to disable checkboxes for all languages without considering the text content. How can I achieve this using CSS?

Here is an example of a label in French which is still visible.

<label class="label_label__1lyg41o0 base_componentBase__159h7ep0 label_variant_regular__1lyg41o1 checkbox_checkbox__1tqnmmh3 base_componentBase__159h7ep0" aria-label="Sélectionner tout"

Update: here is picture of parent and sibling for label
enter image description here


example for french

enter image description here

2

Answers


  1. input[type="checkbox"] {
      pointer-events: none;
    }
    

    Instead of label use input attribute.

    Login or Signup to reply.
  2. I think we can use this selector th[class*="selectAll"] > label and just select the parent of the label which contains the "select all" text then select the label itself:

    th[class*="selectAll"]>label {
      display: none;
      pointer-events: none;
    }
    Select all checkboxes:
    <table>
      <thead>
        <tr>
          <th class="table_headerCellVariant_selectAll_cgtdxkf">
            <label aria-label="Selectionner tout"><input type="checkbox" /></label>
          </th>
        </tr>
      </thead>
    </table>
    <table>
      <thead>
        <tr>
          <th class="table_headerCellVariant_selectAll_cgtdxkf">
            <label aria-label="Select all"><input type="checkbox" /></label>
          </th>
        </tr>
      </thead>
    </table>
    Other checkboxes:
    <input type="checkbox" />
    <input type="checkbox" />
    <input type="checkbox" />
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search