The background-color of a single child within an absolutely positioned element in Chrome may not be displayed if the element has a z-index and overflow scrolling

This test page has been created to showcase the issue:

<html>
<head>
<style>
.panel {
  position: absolute;
  width: 326px;
  max-height: 200px;
  overflow: scroll;
  z-index: 1000;
}
.item-container {
  width: 100%;
  list-style: none;
  outline: 0;
  padding: 0;
  border: 0 none;
  box-sizing: border-box;
  cursor: pointer;
}
.item {
  width: 100%;

}
.item.highlighted {
  color: #fff;
  background-color: #103e61;
}
</style>
</head>
<body>
<div class="panel">
    <ul class="item-container">
        <li class="item">Test1</li>
        <li class="item">Test2</li>
        <li class="item">Test3</li>
        <li class="item">Test4</li>
        <li class="item">Test5</li>
        <li class="item">Test6</li>
        <li class="item">Test7</li>
        <li class="item">Test8</li>
        <li class="item">Test9</li>
        <li class="item">Test10</li>
        <li class="item highlighted">Test11</li>
        <li class="item">Test12</li>
        <li class="item">Test13</li>
        <li class="item">Test14</li>
        <li class="item">Test15</li>
    </ul>
</div>
</body>
</html>

Check it out on Fiddle: https://jsfiddle.net/jfvtc1ek/

When viewed in Chrome version 70.0.3538.77, the "Test11" list item appears in white once scrolled into view. Chrome seems to have trouble rendering the background-color due to the parent's absolute positioning and z-index settings.

The same fiddle behaves correctly in Firefox, raising the question of whether this is a Chrome-specific bug?

Answer №1

Indeed, it seems like a bug.

Specifically for Chrome:

The issue persists even without specifying a position

The problem remains even when not setting a z-index

Even without overflow specified, the bug still occurs

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

Achieving effective targeting of the second segment within a string enclosed in a span tag through increased specificity

When it comes to styling elements, the easiest way is to use classes and assign the properties needed. However, 1. I'm not a huge fan of creating classes all over the place. That's what specificity and CSS mapping are for. 2. Going thro ...

styling a flex container with aligned text and buttons

I'm attempting to align text on the left and button controls on the right within a display: flex div. <CustomFieldContainer> <StyledWellContainer> <FieldDetails key={id}> <H4 bold>{label}</H4> <Styled ...

Issue with Bootstrap navigation bar not displaying on iPad devices

Currently, I am working on creating a custom bootstrap menu that displays properly on an iPad screen size. I have implemented the standard navbar code from Bootstrap with a few tweaks. While it works well on smartphones and laptops, the issue arises when ...

Is it possible to switch between different fabricJS canvases seamlessly?

Consider this scenario where I have three canvas elements: <canvas id="c1" width="400" height="300"></canvas> <canvas id="c2" width="400" height="300"></canvas> <canvas ...

Creating Vertical Text and Div Blocks using CSS

Trying to set up different color section blocks with vertical text on my website's dashboard page. Similar to this example in JSfiddle: http://jsfiddle.net/afpn2y19/4/ <div id="outer"> <div id="inner"> //Feeling lost - ho ...

Guide on exporting Excel data using Angular and TypeScript

My project involves managing a table of information that includes fields for FirstName, LastName, PhoneNumber, Age, and Date. I've created a function that allows me to export the data to an Excel file, but I only want to export specific fields like Fi ...

JavaScript call to enlarge text upon click

I'm struggling to figure out why my font enlargement function isn't working as expected. Below is the code for my font enlargement function: <script type="text/javascript> function growText() { var text = document.getElementBy ...

Having difficulty selecting an element using XPath based on its title

https://i.stack.imgur.com/Of29v.png My XPath: ((//span[text()='Number of Allowances'])/../../../following::div//table[@class='mainTable']//tr[1]//input[@data-automation-id="numericInput"]) The XPath above clearly specifies that the ai ...

Struggling to reveal concealed items on a webpage using jQuery and attempting to cycle through an array without success

Looking to display or hide certain sections on a page based on specific conditions. I want to only show the sections of the page that contain words from the conditionsToShow array. function hideWorkflowConditions() { // initially hide the elements ...

Tips for utilizing the output of a pre-defined function within another function in SASS

How can I effectively utilize the outcome of darken( $var, 10% ) in the SASS function oppositeColor( $darkenedColor )? The code I am working with currently looks like this: $color1: #000000 !default; $color2: darken( $color1, 5% ) !default; $color3: oppos ...

Fill a dropdown menu with options from a JSON object, arranging them in ascending order

I have a JSON hash that I am using to populate a combo box with the following code: $.each(json_hash, function(key, value) { $("#select").append("<option value='" + key + "'>" + value + "</option>"); }); The functionality w ...

Dynamic horizontal scrolling

I need help implementing a site using React that scrolls horizontally. I'm unsure how to implement certain aspects, so I am looking for some assistance. Within a wrapper, I have multiple container Divs. <div class="wrapper"> <div class=" ...

Dynamic Data Drive Multi-Series Line Graph

I am currently working on creating a D3 line chart. I have taken the code from the block builder and adjusted it with my own data. While the code is functional, I'm facing an issue where the labels are not showing up when I hover over the line. My ma ...

Ways to create animation solely using CSS for a div element

After spending hours searching for solutions, I still haven't found the perfect answer without using JQuery. I am attempting to add a slide-up animation effect to my divs. I have tried numerous options, including the simplest one: transition: all li ...

React component utilizes Material UI to detect scrolling within a table

Currently, my table's body size is set to fixed dimensions in accordance with Material UI guidelines. I am looking to implement a functionality that allows me to dynamically load more rows as the user scrolls through the table. Can you recommend the ...

Display or conceal numerous WTForm labels

Is there a more efficient way to hide/show multiple wtform labels? Currently, I am achieving this with the following code: HTML: {{ render_field(var_1, class = "class_1") }} {{ render_field(var_2, class = "class_1") }} {{ render_field(var_3, class = " ...

Navigating through a PHP table, tracking your progress with a

I have encountered a problem that I need help with. I have been searching the internet for information on how to add a progress bar to my PHP code. Most solutions I found use the style method to display the progress percentage. In the image below, you can ...

problem specifically occurring on tablets with fixed positioning

Have you checked out the site I'm referring to here? An unusual issue seems to be occurring specifically on tablets. We implemented the scroll to fixed jQuery plugin to fix the position of the sidebar after scrolling, which works perfectly on all de ...

I'm interested in clicking on an image within a div to trigger a page refresh and then automatically hide the div once the page has refreshed

UPDATE 2 SITUATION To prevent access to quiz content until the page is refreshed, I am employing a semi-transparent image with a top-margin off-set. The following code functions flawlessly on one specific page and only once: JavaScript window.addEventL ...

What is the best way to calculate the number of squares required to completely fill a browser window in real-time?

I am creating a unique design with colorful squares to cover the entire browser window (for example, 20px by 20px repeated both horizontally and vertically). Each square corresponds to one of 100 different colors, which links to a relevant blog post about ...