Struggling to concentrate on the branding

I've been using materializecss for some time now and recently encountered an issue while trying to navigate my website using keyboard tabbing.

The checkbox in materializecss is a custom CSS checkbox, but when I set the tabindex for the label of the checkbox, it only seems to work in Firefox browsers when I use the tab key.

<input type="checkbox" class="group1" id="opt1" />
<label for="opt1" class="group1" tabindex="0">1</label>

Does anyone know of a workaround for this problem?

Answer №1

My solution involves utilizing CSS.

.wrapper {
  margin: 100px;
}

[type="checkbox"]:not(:checked):focus +label:before {
    border: 1px solid red;  
}

[type="checkbox"]:checked:focus +label:before  {
 
    top: -4px;
    left: -3px;
    width: 12px;
    height: 22px;
    border-top: 2px solid transparent;
    border-left: 2px solid transparent;
    border-right: 2px solid red;
    border-bottom: 2px solid red;
    -webkit-transform: rotate(40deg);
    -moz-transform: rotate(40deg);
    -ms-transform: rotate(40deg);
    -o-transform: rotate(40deg);
    transform: rotate(40deg);
    -webkit-backface-visibility: hidden;
    -webkit-transform-origin: 100% 100%;
    -moz-transform-origin: 100% 100%;
    -ms-transform-origin: 100% 100%;
    -o-transform-origin: 100% 100%;
    transform-origin: 100% 100%;
  
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.0/css/materialize.min.css" rel="stylesheet"/>
<div class="wrapper">
  <input type="checkbox" class="group1" id="opt1" />
  <label for="opt1" class="group1" tabindex="0">1</label>

  <input type="checkbox" class="group1" id="opt2" />
  <label for="opt2" class="group1" tabindex="0">2</label>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Achieve perfect alignment of an HTML table by positioning it precisely 36 pixels away from the right edge of the window

I'm struggling to achieve a table that is precisely 36px away from both the left and right edges of the browser window, regardless of CSS. While I can easily set the left margin, getting the exact right margin seems impossible as the `margin-right` CS ...

Interested in learning how to redirect to a different page using vanilla JavaScript after submitting an HTML form with a Django backend?

Recently delving into Django, I encountered a challenge of linking a js file to my HTML form page and saving the form data before moving on to the next screen. My aim was to incorporate a feature where users can click a picture and POST it along with their ...

Employing jQuery with dynamic content within this context

Can anyone help me with jQuery and dynamic content? I'm trying to prepend items to a list and show the contents of a specific item when clicked, but all items' content is being displayed instead. I attempted using (this) without success. $(docum ...

I am currently working on fetching information from a database through ajax and displaying it in a form within a bootstrap modal

If I click on the edit button, I expect to see data populated in a form within a Bootstrap modal using jQuery AJAX method. Here is the image for the edit modal: https://i.stack.imgur.com/LXGo0.png This snippet is for the home page: <?php require_ ...

What is the best way to position a div at the bottom of a web page?

I have a question that may seem basic, but I've been struggling to find a solution. Despite searching for answers, none of the suggestions I've come across have worked for me. My application has two main containers - a header and a content div. T ...

How can I conceal child <div> elements when the parent div is resized?

Struggling to implement a zoom in/out feature on my web app using the jqueryUI slider. Having trouble handling cases where the parent div shrinks too much, causing issues with the child containers. <div class="puck originator inline-block" style="w ...

Place content following a three.js display created within a <div id="mainWindow">

Recently, I created a small Three.js animation and embedded it in my HTML page like this: <div id="mainWindow" class="popup_block"> <!-- JavaScript for simulation --> <script src="../temp/webgl-debug.js"></script> <scri ...

Changing Background Colors of Grid Items in React.js Grid Layout

I'm currently learning React and have created a basic app that shows data from a database in a grid format. I'm looking to customize the background colors of each grid item based on its priority level, which is pulled from the database. The prior ...

The jQuery .animate function seems to be malfunctioning

I recently came across this jsfiddle link: http://jsfiddle.net/2mRMr/3/ However, the code provided is not functioning as expected: setInterval(function () { box.animate({ left: function (i, v) { return newv(v, 37, 39); }, ...

Expansion issue with Bootstrap panel

I am currently using Bootstrap 3 for the development of a social networking site. The issue I'm encountering involves displaying comments within a panel footer on toggle. However, the comments are extending beyond the footer area. Can anyone provide g ...

Incorporating a division using the data() method

Currently, I am in the process of generating a list of flash SWFs. The data for this list is retrieved through an ajax call, which returns a JSON object. To populate the rows with data, I utilize my makeAppRow function. makeAppRow = function(myData) { ...

The change event for the select element is malfunctioning

Currently, I am deep diving into Nodejs with the second edition of the node cookbook. This book has caught my attention because it explains concepts using practical sample code, making it easier to grasp. The example code I am working on is related to Br ...

Unable to trigger $(this).find("a").click(); with JQuery

I have a simple query that I believe the jQuery experts can help me with. I am attempting to implement a functionality for performing an action on gridview row double click, following the instructions on . I have managed to redirect to another page succes ...

Displaying information stored in the database following the selection of an input from a drop

Join me on a journey through my travel table: +---------+---------+------------------+------------+---------+ | id_tour | region | destination | date_tour | price | +---------+---------+------------------+------------+---------+ ...

Using jQuery to loop through a table and retrieve the button value from every row

I have a challenge with dynamically created buttons in a table. My goal is to loop through the table, identify the rows that have a checked checkbox, and retrieve the value of a button within that row. I then need to store these values in an array. Unfortu ...

Utilize the CakePHP form helper to include an HTML element within a form element

I am attempting to generate a basic html output that resembles the following <button class="searchbutton" id="search_button" type="submit">--> <i class="icon-search"></i> Search</button> when using Cake PHP's form h ...

Customize the List Box Appearance for a Specific HTML Item (Option)

I am working on achieving a specific behavior. When using a listBox (or comboBox), the first element (such as "choose one") should have a unique style. Here is an example of code to test: <style type="text/css"> .testX {font-style: italic;} </ ...

Using JQuery to format a new date and assigning a variable within an array's option

I have been attempting to modify the format of a date object by storing it as a variable and then utilizing the .format() method to transform it into the desired format within a single line of an array's option in jQuery. This is the code I am workin ...

Leveraging Angular to retrieve images from Google Feed API

I'm currently working on developing an RSS reader and trying to integrate images from the Google Feed API. While I have successfully extracted the publishedDate and contentSnippet, I am facing difficulty in getting the image src. The code snippets bel ...

Using $.ajax() to store data in the database

Is there a way to save dynamically generated elements from my application.js file into the database? Would the code be similar to this example?: $.ajax({ type: "POST", data: { title: 'oembed.title', thumbnail_url: 'oembed.thumbnail_ur ...