Change inactive selection color in Firefox - css

When i select some text in Firefox and then the window or Iframe loses focus (selecting address bar for Example), then the selection becomes grey, even when a different color is specified in css.
How do i change the color for a disabled selection in Firefox?
What I've tried:
<style>::selection { background-color: green; }</style>
<p>lorem ipsum</p>
Edit:
What i want to use here seem to be ::inactive-selection, but it's not yet implemented in firefox. See https://drafts.csswg.org/css-pseudo-4/#selectordef-inactive-selection
Related bug: https://bugzilla.mozilla.org/show_bug.cgi?id=706209
Does anyone know a workaround? At this point, im considering using some javascript hacks. Any ideas how to do this?

No, you can't
Not on Firefox at least.
Reason I'm answering with a no, is to save both of your time and others who might try to find some solutions / hacks.
Since you already know about the css specification. I might want to add that,
Remember Firefox has it's own version of ::selection, ::-moz-selection. It also has it's own version of :window-inactive, :-moz-window-inactive. Unfortunately using these things together doesn't work.
Source: CSS Tricks
/* Does work */
::-moz-selection {
background: rgba(255,0,0,0.9);
color: white;
}
/* Doesn't work */
::-moz-selection:-moz-window-inactive {
background: rgba(255,0,0,0.3);
}
/* Nor this */
:-moz-window-inactive::-moz-selection {
background: rgba(255,0,0,0.3);
}
Also, Bugzilla has years old bugs requesting this feature and talking about it's inability to handle inactive selections but no responses on those. Here is a list. Some of them are even 11 years old. I am planning to talk to someone about this and report a new bug myself with some more details, might add their response or the bug number here so that you can get updates.
So, for now I think you shouldn't be looking for some hacks, it'll only waste your time.
Thanks
Update: here is the bug to keep an eye on bugzilla, lets see what the dev team has to say.

For text-selection inside a single node/element, a possible workaround can be achieved with javascript.
You can listen for the focus and blur events of the window.
In the event-handler for the blur-event you can check if anything is selected, wrap a span-element around the selected text and clear the selection.
In the event-handler for the focus-event, you can restore the content and selection to its previous states.
Demo:
let range = null;
let span = null;
// browser-window looses focus (blur)
window.addEventListener('blur', function(event){
let selection = window.getSelection();
// abort if selection involves text from multiple nodes
if (selection.anchorNode != selection.focusNode) {
console.log('Selection over multiple nodes is not supported!');
return;
}
// get range from current selection and wrap content in span with custom style
range = selection.getRangeAt(0);
span = document.createElement("span");
span.classList.add("selection-custom-highlight");
span.appendChild(range.extractContents());
range.insertNode(span);
// clear current selection in document
selection.removeAllRanges();
});
// browser-window gets focus
window.addEventListener('focus', function(event){
if (span) {
let selection = window.getSelection();
// replace span with text-node
let node = document.createTextNode(span.textContent)
span.remove();
range.insertNode(node);
span = null;
// clear current selection in document
selection.removeAllRanges();
// add saved range to selection
selection.addRange(range);
}
});
::selection,
.selection-custom-highlight {
background-color: green;
}
<div id="content-1">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
<hr>
<div id="content-2">
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
It is also possible to extend this workaround to handle text-selection over multiple rows:
For that you will have to wrap spans around the selection in anchorNode and focusNode utilizing the values of anchorOffset and focusOffset.
You also have to find all the text-nodes between anchorNode and focusNode (See this answer). And wrap each content in a span-node.
And when the window regains the focus, you would have to undo all the modifications.
Note: This can result in a lot of manipulations to the document and probably lead to some unwanted behavior when using any javascript libraries that interact or attach to these nodes.

Have you tried:
::-moz-selection {
background-color: green;
}

If the browser doesn't support a feature, you can't use this feature.
I know this is not the best answer, but you should try a different browser.
Actually i use Brave! He has all the features that Google Chrome has, because is based on Chromium. It's faster, blocks ads and trackers (you can disable), make HTTPS upgrades, load websites faster and much more.
Brave is an Open-Source project at GitHub: https://github.com/brave
You should try!

Related

add space between react-alice-carousel items?

I tried to create a carousel with this module and I need autoWidth property for my carousel. and the problem is my items are stick to each other and they need some gap in between, but there is no property for such. I tried to change the class margin property on the module itself but no luck. how can I fix this?
const LatestHotels = () => {
const items = [
<CardPrimary
title="Premium Hotel Plaza"
description="Sed interdum metus at nisi tempor laoreet. Integer gravida orci
a justo sodales."
location="27th Brooklyn New York, USA"
rating="4.1"
price={105}
/>,
<CardPrimary
title="Premium Hotel Plaza"
description="Sed interdum metus at nisi tempor laoreet. Integer gravida orci
a justo sodales."
location="27th Brooklyn New York, USA"
rating="4.1"
price={105}
/>,
// truncated for simplicity
];
return (
<div className={LatestHotelsStyles.mainContainer}>
<Header
title="Popular Destination"
subTitle="Explore some of the best tips from around the city from our partners and friends."
/>
<AliceCarousel
infinite
mouseTracking
items={items}
autoPlay
autoWidth
disableDotsControls
autoPlayInterval={4000}
renderNextButton={() => {
return (
<div className={LatestHotelsStyles.carouselNextBtn}>{">"}</div>
);
}}
renderPrevButton={() => {
return (
<div className={LatestHotelsStyles.carouselPrevBtn}>{"<"}</div>
);
}}
/>
</div>
);
};
result:
what I expect to be:
One way that i could find its to add a vertical padding or margin to each item component, so that they have this space between the items, just have to make sure that the first and last element dont have that lateral padding/margin cause that would make the starting and finishing items position a little bit off
.space {
margin: 0 12px;
}
.space:last-child, .space:first-child {
margin: 0;
}

Can CSS psuedo content pull the element's text?

<p class="test">Lorem Ipsum Dolor.</p>
Can a CSS psuedo-element's (:before/:after) content property pull from the DOM element's plain text?
.test:after{ content: html; }
With the result of...
Lorem Ipsum Dolor.Lorem Ipsum Dolor.
Looking for a non-JavaScript solution (if one is possible).
Thanks :)
No, it's currently not possible to retrieve the element's text and display it using the content property without using JavaScript. However, as I pointed out in the comments, you can use the CSS attr() function in order to retrieve the element's attribute value and display it.
For instance, you could add a custom data-content attribute to the element:
[data-content]:after {
content: attr(data-content);
}
<p data-content="Lorem Ipsum Dolor."></p>
If you want to display the same string twice (as your question implies), you could simply use multiple attr() functions:
[data-content]:after {
content: attr(data-content) ' ' attr(data-content);
}
<p data-content="Lorem Ipsum Dolor."></p>
If you use JavaScript, you could simply iterate over the elements and add a custom data-content attribute to the element(s) based on the textContent property of the element:
[].forEach.call(document.querySelectorAll('[data-content]'), function (element) {
element.dataset.content = element.textContent;
});
[data-content]:after {
content: ' ' attr(data-content);
}
<p data-content>Lorem Ipsum Dolor.</p>
<p data-content>Some other string.</p>
It's also worth mentioning that the content property's value is still rendered as a string (and not HTML).

SCSS dynamic color changing [duplicate]

This question already has an answer here:
SASS: randomly pick background-image from a list
(1 answer)
Closed 7 years ago.
I just started using SCSS and I've been having some problems on dynamically changing the color of my website. What I want to do is create a list of colors and every time I refresh the page, it changes the color selected. Here is the code:
SCSS:
$colors: (
#cc6698,
#0869ad,
#ff8300,
#7A86b8,
#f05133,
#2aa9e0,
#71bf45,
#ef0e39,
#9e79d7,
);
$color: nth($colors, random(length($colors)));
However, it changes the color only when I modify the file, not on every page refresh. What should I do? Thanks.
Your code works, but you have to compile your SCSS files (using sass.js) in the browser to see the effect.
HTML:
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolor maiores placeat illo culpa quam, magnam sunt accusantium enim dicta temporibus, reiciendis soluta iure, reprehenderit qui vel perspiciatis suscipit earum asperiores.</p>
SASS:
$colors: (
#cc6698,
#0869ad,
#ff8300,
#7A86b8,
#f05133,
#2aa9e0,
#71bf45,
#ef0e39,
#9e79d7,
);
$color: nth($colors, random(length($colors)));
body {
color: $color;
}
Check this (to see the effect add text to paragraph or refresh the page):
CODEPEN

Auto Height in LibreOffice Calc

Typical you would format auto height rows with PHPExcel like this:
$file = new PHPExcel();
$file->getActiveSheet()->setCellValue('A1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.');
$file->getActiveSheet()->getRowDimension(1)->setRowHeight(-1);
$file->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
$writer = PHPExcel_IOFactory::createWriter($file, 'Excel2007');
$writer->save(str_replace('.php', '.xlsx', __FILE__));
The problem is this doesn't work well when you open such a file with LibreOffice Calc. Instead you have to select the cell, choose Format Cells... and click OK.
It seems this is a known bug but unfortunately the proposed solution by adding the following else block into Classes\PHPExcel\Writer\Excel2007\Worksheet.php at line 1004 doesn't seem to work:
else {
$objWriter->writeAttribute('customHeight', 'false');
$objWriter->writeAttribute('ht', '0');
}
How could this be fixed?
Seems like that's a known bug in Libre Office. Detailed discussion here: https://phpexcel.codeplex.com/discussions/429322

How can I force WebKit to redraw/repaint to propagate style changes?

I have some trivial JavaScript to effect a style change:
sel = document.getElementById('my_id');
sel.className = sel.className.replace(/item-[1-9]-selected/,'item-1-selected');
return false;
This works fine with the latest versions of FF, Opera and IE, but fails on the latest versions of Chrome and Safari.
It affects two descendants, which happen to be siblings. The first sibling updates, but the second doesn’t. A child of the second element also has focus and contains the <a> tag that contains the above code in an onclick attribute.
In the Chrome “Developer Tools” window if I nudge (e.g. uncheck & check) any attribute of any element, the second sibling updates to the correct style.
Is there a workaround to easily and programmatically “nudge” WebKit into doing the right thing?
I found some complicated suggestions and many simple ones that didn’t work, but a comment to one of them by Vasil Dinkov provided a simple solution to force a redraw/repaint that works just fine:
sel.style.display='none';
sel.offsetHeight; // no need to store this anywhere, the reference is enough
sel.style.display='';
I’ll let someone else comment if it works for styles other than “block”.
Thanks, Vasil!
We recently encountered this and discovered that promoting the affected element to a composite layer with translateZ in CSS fixed the issue without needing extra JavaScript.
.willnotrender {
transform: translateZ(0);
}
As these painting issues show up mostly in Webkit/Blink, and this fix mostly targets Webkit/Blink, it's preferable in some cases. Especially since the accepted answer almost certainly causes a reflow and repaint, not just a repaint.
Webkit and Blink have been working hard on rendering performance, and these kinds of glitches are the unfortunate side effect of optimizations that aim to reduce unnecessary flows and paints. CSS will-change or another succeeding specification will be the future solution, most likely.
There are other ways to achieve a composite layer, but this is the most common.
danorton solution didn't work for me. I had some really weird problems where webkit wouldn't draw some elements at all; where text in inputs wasn't updated until onblur; and changing className would not result in a redraw.
My solution, I accidentally discovered, was to add a empty style element to the body, after the script.
<body>
...
<script>doSomethingThatWebkitWillMessUp();</script>
<style></style>
...
That fixed it. How weird is that? Hope this is helpful for someone.
Since the display + offset trigger didn't work for me, I found a solution here:
http://mir.aculo.us/2009/09/25/force-redraw-dom-technique-for-webkit-based-browsers/
i.e.
element.style.webkitTransform = 'scale(1)';
I was suffering the same issue. danorton's 'toggling display' fix did work for me when added to the step function of my animation but I was concerned about performance and I looked for other options.
In my circumstance the element which wasn't repainting was within an absolutely position element which did not, at the time, have a z-index. Adding a z-index to this element changed the behaviour of Chrome and repaints happened as expected -> animations became smooth.
I doubt that this is a panacea, I imagine it depends why Chrome has chosen not to redraw the element but I'm posting this specific solution here in the help it hopes someone.
Cheers,
Rob
tl;dr >> Try adding a z-index to the element or a parent thereof.
The following works. It only has to be set once in pure CSS. And it works more reliably than a JS function. Performance seems unaffected.
#-webkit-keyframes androidBugfix {from { padding: 0; } to { padding: 0; }}
body { -webkit-animation: androidBugfix infinite 1s; }
For some reason I couldn't get danorton's answer to work, I could see what it was supposed to do so I tweaked it a little bit to this:
$('#foo').css('display', 'none').height();
$('#foo').css('display', 'block');
and it worked for me.
I came up here because I needed to redraw scrollbars in Chrome after changing its css.
If someone's having the same problem, I solved it by calling this function:
//Hack to force scroll redraw
function scrollReDraw() {
$('body').css('overflow', 'hidden').height();
$('body').css('overflow', 'auto');
}
This method is not the best solution, but it may work with everything, hiding and showing the element that needs to be redraw may solve every problem.
Here is the fiddle where I used it: http://jsfiddle.net/promatik/wZwJz/18/
I stumbled upon this today: Element.redraw() for prototype.js
Using:
Element.addMethods({
redraw: function(element){
element = $(element);
var n = document.createTextNode(' ');
element.appendChild(n);
(function(){n.parentNode.removeChild(n)}).defer();
return element;
}
});
However, I've noticed sometimes that you must call redraw() on the problematic element directly. Sometimes redrawing the parent element won't solve the problem the child is experiencing.
Good article about the way browsers render elements: Rendering: repaint, reflow/relayout, restyle
I had this problem with a a number of divs that were inserted in another div with position: absolute, the inserted divs had no position attribute. When I changed this to position:relative it worked fine. (was really hard to pinpoint the problem)
In my case the elements where inserted by Angular with ng-repeat.
I cannot believe this is still a problem in 2014. I just had this issue when refreshing a fixed position caption box on the lower-left hand of the page while scrolling, the caption would 'ghost' its way up the screen. After trying everything above without success, I noticed a lot of things were either slow/causing issues due to creating very short DOM relayouts etc causing somewhat unnatural feeling scrolling etc...
I ended up making a fixed position, full-size div with pointer-events: none and applying danorton's answer to that element, which seems to force a redraw on the whole screen without interfering with the DOM.
HTML:
<div id="redraw-fix"></div>
CSS:
div#redraw-fix {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 25;
pointer-events: none;
display: block;
}
JS:
sel = document.getElementById('redraw-fix');
sel.style.display='none';
sel.offsetHeight; // no need to store this anywhere, the reference is enough
sel.style.display='block';
Not that this question needs another answer, but I found simply changing the color by a single bit forced a repaint in my particular situation.
//Assuming black is the starting color, we tweak it by a single bit
elem.style.color = '#000001';
//Change back to black
setTimeout(function() {
elem.style.color = '#000000';
}, 0);
The setTimeout proved critical to move the second style change outside the current event loop.
I use the transform: translateZ(0); method but in some cases it is not sufficient.
I'm not fan of adding and removing a class so i tried to find way to solve this and ended up with a new hack that works well :
#keyframes redraw{
0% {opacity: 1;}
100% {opacity: .99;}
}
// ios redraw fix
animation: redraw 1s linear infinite;
The only solution works for me is similar to sowasred2012's answer:
$('body').css('display', 'table').height();
$('body').css('display', 'block');
I have a lot of problem blocks on page, so I change display property of root element.
And I use display: table; instead of display: none;, because none will reset scrolling offset.
Since everyone seems to have their own problems and solutions, I figured I'd add something that works for me. On Android 4.1 with current Chrome, trying to drag a canvas around inside a div with overflow:hidden, I couldn't get a redraw unless I added an element to the parent div (where it wouldn't do any harm).
var parelt = document.getElementById("parentid");
var remElt = document.getElementById("removeMe");
var addElt = document.createElement("div");
addElt.innerHTML = " "; // Won't work if empty
addElt.id="removeMe";
if (remElt) {
parelt.replaceChild(addElt, remElt);
} else {
parelt.appendChild(addElt);
}
No screen flicker or real update, and cleaning up after myself. No global or class scoped variables, just locals. Doesn't seem to hurt anything on Mobile Safari/iPad or desktop browsers.
I am working on ionic html5 app, on few screens i have absolute positioned element, when scroll up or down in IOS devices (iPhone 4,5,6, 6+)i had repaint bug.
Tried many solution none of them was working except this one solve my problem.
I have use css class .fixRepaint on those absolute positions elements
.fixRepaint{
transform: translateZ(0);
}
This has fixed my problem, it may be help some one
This answer is for those, who is struggling with #danorton's solution using Angular 10.
This solution
sel.style.display='none';
sel.offsetHeight;
sel.style.display='';
works for me only with "buildOptimizer": false in angular.json file.
Looks like optimizer breaks this somehow.
This is fine for JS
sel.style.display='none';
sel.offsetHeight; // no need to store this anywhere, the reference is enough
sel.style.display='block';
But in Jquery, and particularly when you can only use $(document).ready and cannot bind to a the .load event of an object for any particular reason, the following will work.
You need to get the OUTER(MOST) container of the objects/divs and then remove all its contents into a variable, then re-add it.
It will make ALL changes done within the outer container visible.
$(document).ready(function(){
applyStyling(object);
var node = $("div#body div.centerContainer form div.centerHorizontal").parent().parent();
var content = node.html();
node.html("");
node.html(content);
}
I've found this method to be useful when working with transitions
$element[0].style.display = 'table';
$element[0].offsetWidth; // force reflow
$element.one($.support.transition.end, function () {
$element[0].style.display = 'block';
});
the "display/offsetHeight" hack didn't work in my case, at least when it was applied to the element being animated.
i had a dropdown menu that was being open/closed over the page content. the artifacts were being left on the page content after the menu had closed (only in webkit browsers). the only way the "display/offsetHeight" hack worked is if i applied it to the body, which seems nasty.
however, i did find another solution:
before the element starts animating, add a class that defines "-webkit-backface-visibility: hidden;" on the element (you could also use inline style, i'd guess)
when it's done animating, remove the class (or style)
this is still pretty hacky (it uses a CSS3 property to force hardware rendering), but at least it only affects the element in question, and worked for me on both safari and chrome on PC and Mac.
This seems related to this: jQuery style not being applied in Safari
The solution suggested in the first response has worked well for me in these scenarios, namely: apply and remove a dummy class to the body after making the styling changes:
$('body').addClass('dummyclass').removeClass('dummyclass');
This forces safari to redraw.
above suggestions didnt work for me. but the below one does.
Want to change the text inside the anchor dynamically. The word "Search". Created an inner tag "font" with an id attribute. Managed the contents using javascript (below)
Search
script contents:
var searchText = "Search";
var editSearchText = "Edit Search";
var currentSearchText = searchText;
function doSearch() {
if (currentSearchText == searchText) {
$('#pSearch').panel('close');
currentSearchText = editSearchText;
} else if (currentSearchText == editSearchText) {
$('#pSearch').panel('open');
currentSearchText = searchText;
}
$('#searchtxt').text(currentSearchText);
}
I was having an issue with an SVG that was disappearing on Chrome for Android when the orientation was changed in certain circumstances. The below code doesn't reproduce it, but is the setup we had.
body {
font-family: tahoma, sans-serif;
font-size: 12px;
margin: 10px;
}
article {
display: flex;
}
aside {
flex: 0 1 10px;
margin-right: 10px;
min-width: 10px;
position: relative;
}
svg {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
}
.backgroundStop1 {
stop-color: #5bb79e;
}
.backgroundStop2 {
stop-color: #ddcb3f;
}
.backgroundStop3 {
stop-color: #cf6b19;
}
<article>
<aside>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="100%" width="100%">
<defs>
<linearGradient id="IndicatorColourPattern" x1="0" x2="0" y1="0" y2="1">
<stop class="backgroundStop1" offset="0%"></stop>
<stop class="backgroundStop2" offset="50%"></stop>
<stop class="backgroundStop3" offset="100%"></stop>
</linearGradient>
</defs>
<rect x="0" y="0" rx="5" ry="5" width="100%" height="100%" fill="url(#IndicatorColourPattern)"></rect>
</svg>
</aside>
<section>
<p>Donec et eros nibh. Nullam porta, elit ut sagittis pulvinar, lacus augue lobortis mauris, sed sollicitudin elit orci non massa. Proin condimentum in nibh sed vestibulum. Donec accumsan fringilla est, porttitor vestibulum dolor ornare id. Sed elementum
urna sollicitudin commodo ultricies. Curabitur tristique orci et ligula interdum, eu condimentum metus eleifend. Nam libero augue, pharetra at maximus in, pellentesque imperdiet orci.</p>
<p>Fusce commodo ullamcorper ullamcorper. Etiam eget pellentesque quam, id sodales erat. Vestibulum risus magna, efficitur sed nisl et, rutrum consectetur odio. Sed at lorem non ligula consequat tempus vel nec risus.</p>
</section>
</article>
Day and half later after poking and prodding and not happy with the hacky solutions offered here, I discovered that the issue was caused by the fact it seemed to keep the element in memory while drawing a new one. The solution was to make the ID of the linearGradient on the SVG unique, even though it was only ever used once per page.
This can be achieved many different ways, but for our angular app we used lodash uniqueId function to add a variable to the scope:
Angular Directive (JS):
scope.indicatorColourPatternId = _.uniqueId('IndicatorColourPattern');
HTML Updates:
Line 5: <linearGradient ng-attr-id="{{indicatorColourPatternId}}" x1="0" x2="0" y1="0" y2="1">
Line 11: <rect x="0" y="0" rx="5" ry="5" width="100%" height="100%" ng-attr-fill="url(#{{indicatorColourPatternId}})"/>
I hope this answer saves someone else a days worth of face-smashing their keyboard.
I would recommend a less hackish and more formal way to force a reflow: use forceDOMReflowJS. In your case, your code would look as follows.
sel = document.getElementById('my_id');
forceReflowJS( sel );
return false;
I found that just adding a content style to the element forced it to repaint, this should be a different value every time you want it to redraw and doesn't need to be on a pseudo element.
.selector {
content: '1'
}
I tried morewry answer but it does not work for me.
I had trouble to have the same clientWidth with safari comparing to others browsers and this code solved the problem:
var get_safe_value = function(elm,callback){
var sty = elm.style
sty.transform = "translateZ(1px)";
var ret = callback(elm)//you can get here the value you want
sty.transform = "";
return ret
}
// for safari to have the good clientWidth
var $fBody = document.body //the element you need to fix
var clientW = get_safe_value($fBody,function(elm){return $fBody.clientWidth})
It is really strange because if I try again to get the clientWidth after get_safe_value, I obtain a bad value with safari, the getter has to be between sty.transform = "translateZ(1px)";
and sty.transform = "";
The other solution that works definitively is
var $fBody = document.body //the element you need to fix
$fBody.style.display = 'none';
var temp = $.body.offsetHeight;
$fBody.style.display = ""
temp = $.body.offsetHeight;
var clientW = $fBody.clientWidth
The problem is that you lose focus and scroll states.
This code will rerender css
document.body.style.display = 'flex';
setTimeout(() => (document.body.style.display = ''), 0);
Setting the transform CSS to scale(0.9999) apparently works in the newest chrome.
function redraw(node){
// Adjust the 200 as fastest as you can
// or, change the setTimeout to requestAnimationFrame as soon as the element
// is drawn
setTimeout(() => (node.style.transform = "scale(0.9999)"), 200);
}
I found that my issue was resolved by #morewry's excellent answer, and furthermore that the will-change property arrived since.
CSS will-change or another succeeding specification will be the future solution, most likely.
In my case, the value of will-change: transform; alone was effective in Safari 14.
.wont-update {
will-change: transform;
/* for Safari < 9.1 */
transform: translateZ(0);
}
https://developer.mozilla.org/en-US/docs/Web/CSS/will-change
https://caniuse.com/will-change
I also faced the same issue working with Angular 10. I tried many solutions but nothing seems to be working.
The fix which worked for me is handling it through JS. I just removed the element from DOM and added again using ngIf.
HTML:
<div *ngIf="showElement">
Contents of your element
</div>
JS:
this.showElement = false;
setTimeout(() => {
this.showElement = true;
}, 10);

Resources