vicb/bsmSelect

Weird behaviour in Chrome when using the back-button

aleksblendwerk opened this issue · 2 comments

To reproduce this, try the following:

  1. Open the example.html in Chrome
  2. Go to example 5 and put 'Paris' behind 'Boston'
  3. Submit the example 5 form
  4. Go back (via the browser's back-button)
  5. The list of selected items now displays 'Singapore' and 'Sydney'

I am using the latest Chrome 6.0.472.63 and can't reproduce this in the latest Firefox.

I know using the back-button is about the meanest thing you can do and also this might be Chrome-related but I thought I'd create an issue here nonetheless.

vicb commented

I confirm the issue using Chrome 7.0.517.24 beta.

You can see the cause of the defect quite easily by setting the debugMode option to true: sorting make selected options from the original select move toward the end of the select input.

If 'Paris' and 'Boston' are sorted then 'Paris' and 'Boston' options will be moved from their original position to the end of the list. When you come back (back button) the selection is right (last 2 options are selected) but the option order is not restored as it was just before the submit - but the html order is used instead. Then you end up with the last two cities (in html order) selected i.e. 'Singapore' and 'Sidney'.

  • FF does not have the issue as options order is restored as it was before submitting (i.e. 'Paris' and 'Boston' at the end)..
  • Other examples does not have the issue are they are restored to a 'known' state when the page is loaded (using js).

I would suggest you to submit a bug to the chromium project.

vicb commented

Just to make it clear: this issue occurs when your original select as options hardcoded in the the html (which is highly probable) and you are using the sortable plugin