Text "movement/vibration" in screen when adjusting dimensions in Firefox for Mac

I am currently involved in a project centered around showcasing a variety of fonts to users for them to experiment with, allowing them to adjust size and spacing using sliders.

While the functionality works seamlessly on Chrome and Safari, a peculiar issue arises on Firefox where the text consistently jumps up and down within the input field as the size changes.

https://i.sstatic.net/gMKVC.gif

This jumping behavior seems to occur at regular intervals.

Edit

After simplifying my original code, here is the pertinent snippet. I've observed this "jumping" phenomenon while testing in Firefox.

// start
window.onload = setup;

function setup() {
  sliderEventAssign("size-slider", fontSizeEvent);
}

// event handlers
function fontSizeEvent(event) {
  var path = event.path || (event.composedPath && event.composedPath());
  var root = path[3];
  var value = round(event.target.value);

  // update size value
  root.getElementsByClassName("font-preview")[0].style.fontSize = value + "px";
  root.getElementsByClassName("size-value")[0].innerText = value + " px";
}


// utils
function sliderEventAssign(selector, handler) {
  var sliders = document.getElementsByClassName(selector);
  Array.prototype.forEach.call(sliders, function (el) {
    el.addEventListener('input', handler, false);
  });
}

function round(a) {
  return Math.round(a * 100) / 100;
}
.interactive-font {
    overflow: hidden;
    font-size:20px;
    min-height: 670px;
}

.interactive-font span, .interactive-font p {
    cursor: default;
}

.tools {
    display: grid;
    grid-template-columns: 1fr 180px 240px 1fr 212px 145px 2fr;
    grid-gap: 10px;
    align-items: center;
    font-family: sans-serif !important;
    margin: auto 10px;
}

.shown .slider-wrapper {
    display: block !important;
}


.font-preview {
    width: 100%;
    font-size: 250px;
    display: block;
  font-family: serif;
    border:none;
    background-image:none;
    background-color:transparent;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    -webkit-appearance: none;
}

.font-preview::selection {
    background-color: rgba(0,0,0,0.2);
}

.slider-value {
  width: 80px;
  align-self: center;
}

.size-slider {
    width: 140px;
}

input:focus, button:focus {
    outline: none;
}
   <div id="FontName" class="interactive-font">
        <div class="tools">
            <div class="slider-wrapper">
                <input type="range" min="16" max="400" value="250" step="1" 
                       class="slider size-slider" />
                <span class="size-value slider-value">250 px</span>
            </div>
        </div>
    
        <div class="text-field">
            <input class="font-preview" 
                   type="text" value="Hello" 
                   spellcheck="false"
                   style="font-size: 250px;"/>
        </div>
    </div>

I've also noticed that this issue arises when using serif fonts, but not with sans-serif

Any insights on what might be causing this problem? I've tried adjusting line-height and anchoring it to the bottom, but to no avail.

EDIT2

I will provide a video demonstration of how the problem manifests in the example above on my Firefox version 90.0.2 running on macOS 10.15.6 (MacBook Pro 16-inch, 2019).

https://i.sstatic.net/6cneX.gif

Answer №1

I recently conducted an experiment involving a CSS animation to test the animatability of the font-size property.

I observed that Firefox (on Windows10) provided a smoother experience compared to Chrome, which occasionally exhibited a subtle size jump (possibly around a pixel's worth, though not certain).

.font {
  font-family: serif;
  display: block;
  width: 100%;
  font-size: 250px;
  border: none;
  background-image: none;
  background-color: transparent;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
  -webkit-appearance: none;
  animation: animate 10s linear infinite;
}

@keyframes animate {
  0% {
    font-size: 250px;
  }
  50% {
    font-size: 10px;
  }
  100% {
    font-size: 250px;
  }
}
<input class="font" value="Some text" />

Is there any specific setting in your code to control animation steps?

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

Curves are unable to form on borders using the border-radius property

While working on a webpage, I encountered an issue with CSS attributes and table borders. Despite using the border-radius attribute, the border didn't round along with the background; it just stayed at a corner. Below is my code snippet, any help is g ...

Styling child elements in Angular using css from its parent element

I have a question: Regarding the structure below <component-parent> <first-child> <second-child> <third-child></third-child> </second-child> </first-child> </component-parent> Now I want t ...

What is the best way to design a webpage that adapts to different screen heights instead of widths?

I'm in the process of designing a basic webpage for a game that will be embedded using an iframe. The game and text should always adjust to fit the height of your screen, so when the window is small, only the game is displayed. The game will be e ...

Ensure that any relevant information is placed adjacent to a floated image

I am currently designing a responsive webpage featuring images of people's faces placed next to descriptive text. At smaller screen widths, everything looks perfect. However, as the page widens, the text for one person starts next to the image of the ...

What is the best way to center a grid item in Material-UI within a React application?

I'm struggling with centering a grid element in MUI v5 and aligning a long paragraph to the left side while adding horizontal margin for big screens. Can anyone help me out with this? Thank you. <Box style={{ backgroundColor:" ...

Is it necessary to restart the IIS Site when altering the contents of index.html?

I am currently working on updating a website that runs on a Custom Designed CMS with files using the .asp extension. The site seems to be quite dated and is hosted on an IIS Server, which I do not have direct access to. The user has requested some changes ...

Transform ajax functionality into jquery

I need help converting an AJAX function to a jQuery function, but I'm not sure how to do it. function convertToJquery() { // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Set up variables needed to send to PHP file var ur ...

Unable to achieve text centering within a button using HTML and CSS

I'm diving into the world of HTML/CSS for the first time and encountering some issues along the way. In my setup.html, I created a "Continue" button and applied a class to style it in styles.css. However, I'm facing an issue where text-align cen ...

Is there a way to make the iOS Safari address bar shrink when scrolling, all while having a flexbox sticky footer inside a container?

I have implemented a standard flexbox sticky footer solution in my code: <body> <div class="wrapper"> <div class="header">Page Header</div> <div class="body"> <div class="b ...

Is it necessary to include the Roboto font when using MUI?

After reviewing the Material UI documentation, it appears that users are responsible for loading the Roboto font: Material UI is designed to use the Roboto font by default. You may add it to your project with npm or yarn via Fontsource, or with the Googl ...

What is the best way to make the child Div float to the bottom of the parent Div?

Screenshot I attempted various CSS techniques in an effort to make the .booknetic_appointment_container_footer float to the bottom of #booknetic_theme_5, but unfortunately, I was unsuccessful. The closest solution I found involved hardcoding padding, but ...

Trigger the animation of a Div element when the cursor hovers over a different Div

I am interested in creating an animation where one div moves when the mouse hovers over another div elsewhere on the page. Here is an example... CSS #blue-box { position:absolute; margin-left:50px; margin-top:50px; height:100px; width:100px; background-c ...

Cannot retrace steps in file tree using ../

My website has a file structure set up like this: css style.css other files... templates index.html other files... I am attempting to reference the style.css file from my index.html document. My initial attempt was to navigate back a directory u ...

I am looking for a pair of HTML tags that will allow one to be visible while the other is hidden, and then switch when needed

I am in the process of constructing a webpage dedicated to learning Japanese vocabulary. Each word will be presented within a sentence, just like the example shown below. 森林に散歩する take a walk in the forest In order to facilitate the practic ...

What could be causing the tooltip to malfunction in jQuery?

The tooltip is not appearing as expected, only the title is displaying in the browser. What can be done to fix this? Below is the code snippet: HTML Code: <form action="/validate.php" method="post" id="myform"> <table width="100%" border="1"> ...

The text and buttons exceed the size limits of the popup box

Currently, I am tasked with updating an old website that includes a popup box containing an iFrame and nested tables. The content within these tables consists of text and two input boxes at the bottom. Everything within the box looks fine on screen resolu ...

How can I code a div to automatically scroll to the top of the page?

I'm attempting to implement something similar in WordPress - I want a div containing an advertisement to initially start 300px down the page, then scroll up with the page until it reaches the top, and finally stay there if the user continues to scroll ...

Firefox and IE are unable to make changes to cssRules

To update existing global CSS rules, I access the document.styleSheets property to locate the rule and make modifications. The selector can be modified by accessing the selectorText property. Sample CSS code: <style type="text/css"> .class { ...

What is the best way to retrieve text that is viewable to the user when there is a text overflow situation

When using ellipsis in a text input to indicate overflow, is there a way to determine what text is visible to the user versus hidden behind the ellipsis? Thank you for any help! https://i.stack.imgur.com/8iLBQ.png In my scenario, I need to display a list ...

Ways to retrieve the marginLeft of an element set with absolute positioning?

Currently, I am attempting to display an information box when hovering over an element with the mouse. The issue I am facing is that the element moves, and I need to determine its left margin. However, the element does not have a margin-left property in ...