Chrome users may encounter difficulty grabbing the horizontal textarea scrollbar if a border-radius has been applied

Check out this JSFiddle for more information

<textarea wrap="off" rows="5" style="border-radius: 4px">aaaaaaaaaaa
  aaaaaaaaaaa
  aaaaaaaaaaa
  aaaaaaaaaaabbbbbbbbbaaaaaaaaaaabbbbbbbbbaaaaaaaaaaabbbbbbbbbaaaaaaaaaaabbbbbbbbbaaaaaaaaaaabbbbbbbbb
  aaaaaaaaaaa
  aaaaaaaaaaa
  aaaaaaaaaaa
  aaaaaaaaaaa
  aaaaaaaaaaa
  aaaaaaaaaaabbbbbbbbb
  aaaaaaaaaaabbbbbbbbb
  aaaaaaaaaaabbbbbbbbb
</textarea>
  1. Scroll to the middle of the text box
  2. Attempt to grab the horizontal scrollbar with your mouse
  3. You'll notice that you can't, due to the blinking text cursor behind it!

If you remove the border-radius style and retry, you will find that you are able to grab the horizontal scrollbar. It also begins functioning once you scroll to the very bottom.

This functionality works smoothly in Firefox. I opted to use the wrap attribute instead of CSS as it is the most compatible method across browsers, including IE11 (source: HTML Textarea horizontal scroll). Using CSS caused an issue in IE11 where pressing the return key produced a space instead of a new line.

Does anyone know how to resolve this issue in Chrome?

Edit: Bug has been resolved in Chrome version 52

Answer №1

Fixing the scrollbar issue can be achieved by adding position:relative; as mentioned in my previous comment.

Alternatively, you may want to experiment with setting border to none and using box-shadow for a similar effect.

In this fiddle, you can explore three different options: https://jsfiddle.net/p6jw6qvf/

#one{
    border: none;
    box-shadow: 0 0 5px 2px #9a9a9a;
}

#two{
    position: relative;
    border-radius: 4px;
}

Keep in mind that if you choose option #two, the scrollbars will overlap the border. To address this, consider using custom scrollbars with border-radius applied to them.

Answer №2

OPTION 1:

In the past, I encountered a similar issue and devised a makeshift solution that may not be the most elegant, but it gets the job done for me.

To address the problem, start by enclosing your textarea within a div element with the following properties:

div {
    border: 1px solid rgb(169,169,169);
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
}

Next, remove the border from the textarea and apply vertical-align: top to eliminate any unwanted spacing caused by elements with display: inline-block:

textarea {
    vertical-align: top;
    border: 0;
}

This approach may not be considered professional or reliable, but visually matches the appearance of the textarea in your code snippet. Exercise caution when implementing this method as it could behave unexpectedly in certain scenarios.

Example:here.

Snippet:

div {
  border: 1px solid rgb(169, 169, 169);
  border-radius: 4px;
  overflow: none;
  display: inline-block;
}

textarea {
  vertical-align: top;
  overflow-x: visible;
  border: 0;
}
<div>
  <textarea wrap="off" rows="5">aaaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaabbbbbbbbbaaaaaaaaaaabbbbbbbbbaaaaaaaaaaabbbbbbbbbaaaaaaaaaaabbbbbbbbb
    aaaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaa
    aaaaaaaaaaabbbbbbbbb
    IT'S 2016 AND I CANT EVEN HAVE A HORIZONTAL SCROLLBAR ON A TEXTBOX.
  </textarea>
</div>


OPTION 2:

Through testing, I discovered that applying position: relative to the textarea seems to resolve the issue, at least in my Chrome version. However, if you prefer an alternative positioning method, the above solution should suffice.

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

Is it considered good practice to utilize Vue.js for managing global shared state and implementing for loops outside of components?

Just getting started with Vue.JS and experimenting with creating two lists of books (read and unread) from a shared object in the global data state. This is my approach - working demo (works like a charm! However, I'm wondering if this is considered ...

Update a section of my PHP webpage using setInterval()

How can I refresh a PHP value every second using setInterval()? I am familiar with refreshing values in HTML, but now I want to do the same with PHP values. Here is my code: <script> setInterval(function() { <?php $urlMachineOnline = ' ...

Matching multiple divs with different ids in PHP using preg_match_all and regex

I have an HTML page structured like this: <!DOCTYPE html> <html> .... <body> <div class="list-news fl pt10 "> Blue </div> <div class="list-news fl pt1 ...

Introducing the new default in Google Chrome: Now accessing window.opener for target="_blank" links after rel="noopener" is the standard feature

Exploring a new attribute called rel="noopener", I discovered that it keeps opened windows unaware of their opener. After some experimentation, I consistently found window.opener === null, only to realize that this is now the default behavior in ...

Form-linked Progress Bar

This is a little project I created (for fun and learning purposes, even though it may not be the most optimized solution). If you're interested, here's the link to the code: https://codepen.io/paschos/pen/xxGXMQb I'm currently seeking assi ...

Vertical centering not functioning as expected due to issues with margin-top and margin-bottom

I'm having trouble centering my red block in the middle of the webpage, with the footer block at the bottom and the white block between them. Oddly enough, margin-top doesn't seem to be working for me, but left and right are functioning fine. Al ...

Having Trouble with jQuery toggleClass

I'm currently working on a project where I have implemented a button that displays a menu when clicked. I am attempting to change the color of the button when it is active, however, the toggleClass function is not behaving as expected. Below is the co ...

jQuery divs seem to "gaze up" towards the mouse pointer

I am attempting to recreate a fascinating effect using jQuery - where "cards" move in response to the mouse cursor as if they are looking up at it. I have come across a script that almost achieves what I need, but I require the ability to control the mov ...

Screening through the outgoing html documents

For all my *.html files, I have added custom syntax that must be filtered through filter.php before being displayed. I believe this can be achieved using .htaccess. It's important to note that I do not want the *.html files to be parsed as PHP. ...

The value property of the input element is returning as undefined

The input value entered is always returning undefined. Despite trying various solutions found in similar questions, my jQuery code continues to return undefined. jQuery: $( document ).ready(function() { $('#Input').keypress( function(e ...

Prevent overlapping of range sliders in HTML and CSS

I have designed a range slider with two buttons, but they are overlapping each other. I want to ensure that they do not cross over one another - where the value of the first button should be equal to the minimum value of the second button, and the maximum ...

The issue of flickering while scrolling occurs when transitioning to a new page in Angular

I have encountered an unusual issue in my Angular 13 + Bootstrap 5 application. When accessing a scrollable page on small screen devices, the scrolling function does not work properly and causes the page to flicker. I observed that this problem does not o ...

Column div being obscured by footer

My footer is causing overlap issues with the div above it on my mobile website. Here's a visual representation: Current view on my phone: https://i.stack.imgur.com/RpvWM.png Desired view: https://i.stack.imgur.com/KHVcm.png The code for the are ...

Is there a way for me to retrieve the price using the xpath?

I have this code snippet currently: CurrentPrice=driver.find_element_by_xpath('/html/body/div[2]/div[4]/div[2]/header/div/div[3]/div[1]/div/div/div/div[1]/div[1]').get_attribute("title") This is the price data I am attempting to extrac ...

CSS code preventing hyperlink from functioning

My website is almost complete, but I'm running into an issue with some hyperlinks on my event registration page. The first link works fine, but the second one does not. To troubleshoot, I created a test page with just the two links and still encounter ...

I am having difficulty with my ajax code and I am unsure of how to resolve it

Here is the code snippet. I am encountering an issue where pressing the button does not trigger any action, while I simply want to ensure that the AJAX functionality is working properly. The expected behavior is for an alert message to be displayed when th ...

Show the name of the current user in a WordPress form using a readonly input field

How can I display the logged-in WordPress username (display name) in a form input field that is set to readonly? I have already checked out the Function Reference/wp get current user, but haven't had any success with it. Take a look at the code snip ...

Add opening and closing HTML tags to enclose an already existing HTML structure

Is there a way to dynamically wrap the p tag inside a div with the class .description-wrapper using JavaScript or jQuery? This is the current html structure: <div class="coursePrerequisites"> <p> Lorem ipsum.. </p> </ ...

The PHP script is exhausting memory resources and triggering a fatal error

I encountered the following error message: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 528384 bytes) in /home/u234536193/domains/monetizingonline.com/public_html/wp-includes/wp-db.php on line 2024 The problematic cod ...

Revamping Tab Styles with CSS

Currently, I am working on a mat tab project. The code snippet I am using is: <mat-tab-group> <mat-tab [label]="tab" *ngFor="let tab of lotsOfTabs">Content</mat-tab> </mat-tab-group> If you want to see the liv ...