Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8427511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:48:03+00:00 2026-06-10T04:48:03+00:00

I’m working on a control where you’d have two multi-select lists with collections of

  • 0

I’m working on a control where you’d have two multi-select lists with collections of items that can be moved between one another.

There’s a possibility that the contents of one or both lists will be wider than I’d like the item itself to be, and so I have them each represented by two divs and a select as follows:

<div class="container">
    <div class="concealer">
        <select size="4">
            ...
        </select>
    </div>
</div>

Putting the select within a div allows horizontal scrolling (since select doesn’t). The select is resized (size attribute is set) to fit its contents as items are added or removed. The “concealer” div avoid double scroll bars hides the vertical scroll bar on the select, and it is vertically sized when the select changes as well.

I’m using html5. IE9 in standards mode and Firefox are fine. The problem that I’m having is with Chrome (actually Safari as well, so… webkit). If the control is in a window or container (a div for example) with vertical scrolling, and you have it scrolled to the point where you can’t see the top of the select, if the bottom of the select is visible (or would be visible in the outer container, if overflow could be seen), when you click an item in the select, causing the select to focus, Chrome scrolls the outer container either to its top or far enough so that the top of the select would be visible if you could see it through the divs which contain it.

As noted, if the bottom-most option in the select is visible in the (containing) window, but the top of the select is not, chrome will scroll.

I have written script to adjust the scrollTop of the scrolled window back to its current position, and that would work, except that I am finding that in my staging and production environments, the adjustment being done by chrome is also causing the actual option selection to happen AFTER chrome has done its own adjustment, which means the click registers on the wrong option (it’s off by however much the browser scrolled up), It’s a problem whether there’s an onfocus event on the select or not.

I haven’t been able to get the option select problem to happen in a barebones test like this, but the scrolling itself is a problem.

The only way I’ve found to prevent this from happening is to size the select to some number that’s large enough to put the bottom of the select well outside the bottom of the outer container, but this is not at all ideal, as it leaves lots of whitespace, is a bad user experience, and fights a problem that (while fairly profound) only affects webkit.

Does anyone know how else I might prevent or counteract this behavior?

I did have images to go with this, but understandably, new users can’t post images.
Here’s a js fiddle that should allow you to easily reproduce the issue: http://jsfiddle.net/4N9Kg/22/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:48:04+00:00Added an answer on June 10, 2026 at 4:48 am

    I have a workaround.. (DISCLAIMER: It’s a workaround not a solution)

    $('#sel').mousedown(function(e){
        $(e.target).attr('selected', 'selected'); //select the clicked <option> item
        e.preventDefault();
    });
    

    DEMO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.