The CSS descendant selector does not seem to be functioning properly with the focus state on iOS

In order to display content using the :focus state when the parent element has focus, I have used the following CSS code:

.child { display: none; }
.parent:focus .child { display: block; }

It's important to note that the parent element has tabindex="0" set. I am wondering if there is a way to make this work in iOS browsers without using javascript. Can a CSS-only solution be implemented?

You can view a simplified version of this setup on JSFiddle here: http://jsfiddle.net/E8zCU/

Answer №1

If you're facing a similar issue, I found a solution that worked for me on this thread.

One user in the discussion suggested the following fix:

<body ontouchstart="">

Simply adding this line to the beginning of your HTML code should resolve the problem.

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

The styled-components in CSS are causing some issues with the color themes

Link to Image Showing the Issue. I have implemented themes and colors in my React application successfully, but I am encountering a peculiar problem with the labels. Whenever I switch the theme from green to blue and then back to green, focusing on the inp ...

How to properly position a YouTube video frame in the center?

<section> <h3>Find out about us</h3> <p>British Airways Virtual is a leading virtual airline within the Infinite Flight community. Boasting a community of over 50 pilots, we offer a vibrant and engaging experience. Come and ...

Align the icon and text both vertically and horizontally in the center

I have a collection of links: <ul> <li><a href="#" class="icon26 icon1">Link 1</a></li> <li><a class="icon26 icon2">Link 2</a></li> </ul> Each link comes with an icon. My ...

Creating an animated border that fades to transparency using keyframes

I am attempting to create a simple animation of a circle with a border that transitions from red to a transparent color. My approach is to initially set the color to red and then animate it to transparent using keyframes as follows: .pulse{ margin: 20 ...

Is it safe to assume that when Azure's NotificationOutcomeState is marked as Completed, the notification has been successfully

When using the Per Message Telemetry feature of Azure Notification Hub, you may encounter various outcome states. One common question is regarding the meaning of the 'Completed' state. According to the documentation, 'Completed' indicat ...

Click here to get the button click link

Is there a method to obtain the link of a button click on a website? This is the Website and it features a play button. I am looking for a way to capture the link triggered by clicking the play button so that the audio starts playing automatically each t ...

Various settings in JQuery UI Slider

Does anyone know how to customize the steps in a jQuery UI slider? I want to set specific values as steps, like 0, 1200, 2000, 2200, and 3000. Any suggestions on how to achieve this? const rangeSliderInit = () => { const valueArray = [0, 400, 1000, 1 ...

Tips for aligning the dialog box in the center of the screen based on the current scroll position

Is there a way to center the dialog box vertically at the current scroll position of the window when any of the "show dialog" buttons are clicked? For instance, if I click on location 3, I want the dialog box to be centered vertically within the current v ...

What is the reason radio:checked is not properly changing the color of the div?

Having issues with my circle divs not changing to a black background when the linked radios are checked. This is for a carousel that cycles automatically in JavaScript. Manually changing the color works fine, but the CSS doesn't seem to apply. Help, p ...

Managing the Loading Sequence of CSS Files in Nuxt and Vuetify

I am facing an issue in my Nuxt/Vuetify application where I cannot seem to load my custom CSS file after Vuetify's CSS. Despite attempting to change the order in the CSS array like so: css: [ '~/assets/style/main.scss', '~/asse ...

Creating a bottom bar using React and Material UI

I'm currently working on implementing a footer that will be displayed on every page of my Next.js application. To style this, I am utilizing Material UI. The following component is responsible for defining the layout across all pages of the app: impo ...

How to effectively use flexbox to resize child elements in a CSS layout

My goal is to create a layout where a child element fills the entire flex box of a flex layout. Here is an example of the HTML structure I am using: <div class="parent"> <div class="child1"> should have 100px height </div&g ...

reactjs dynamically adjusting background image size based on window dimensions

I'm tackling a ReactJs project at the moment. How can I adjust the background image to resize based on window size, particularly when toggling the device toolbar? .container{ background: url('../image/2.png'); } Currently, the backgrou ...

Speeding up your responsive design with a single CSS file or multiple files is a crucial

There are numerous discussions on whether it's better to have many CSS files or just one, with the consensus being that using a single file reduces the number of HTTP requests. However, my question is a bit different. Personally, I tend to use two CS ...

Customizing the active link color in Bootstrap dropdown menus

Is there a way to customize the color and background of an active link in a boostrap's dropdown menu? Despite trying to override bootstrap's @dropdownLinkColorActive and @dropdownLinkBackgroundActive variables, the changes don't seem to tak ...

Best practice for transmitting information via a socket using NSOutputStream

I am new to socket programming on iOS and I am struggling to understand the purpose of the NSStreamEventHasSpaceAvailable event for NSOutputStreams. While Apple's official documentation (Listing 2) suggests that data should be written to the output b ...

Personalize the drop area in Filepond

Is there a way to customize the filepond droparea by adding custom HTML with placeholder images to guide users on what kind of images should be uploaded and allow multiple uploads? https://i.sstatic.net/VFGfJ.png I attempted to add placeholders in an abs ...

Displaying maximum number of items in each row using ngFor

Is there a way to automatically create a new row within the 'td' element after the ngFor directive has generated 10 image repeats? Currently, all the images are displayed in a single td and as more images are added, they start to shrink. <td ...

After hovering over the box, we can observe the :after pseudo

Encountered an issue where the box fails to appear when hovering over the :after element. HTML CODE: <div class="top_line_dropdown"> <span class="logged_in_user"> <a href="/cdn-cgi/l/email-protection" class="__cf_em ...

Converting Swift 4 JSON data into a collection of dictionary objects

Upon receiving a JSON response, the data looks like the following: [ { "category": C5, "group": G43 }, { "category": C5, "group": G43 }, { "category": C10, "group": G1 }, { ...