Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #75, on January 7th, 2012, 11:45 PM »
Hmm, I shouldn't have tested my select box on IE... :P

Fixed a few bugs in IE6 today, but some remain.
- If select box has a scrollbar, in IE7 there's extra padding added to the left of the box items... A gap of exactly 16 pixels. I set margin and padding to 0 and list-style to none, it does remove the discs but doesn't change the margin... I don't think I SHOULD use negative margins, should I...?

- As mentioned in the latest changelog, if you move the thumb and release your mouse button when outside the select box, it will close in IE 6-9, as opposed to other browsers. For this one, it's even more complicated... I believe it's due to IE not firing the events correctly, or not taking into account a click's stopPropagation in a parent's mouseup event or something. Anyway, others browsers run it... So, I changed the click event to a mousedown event -- and it suddenly started working! Yay... However, now when I click a box item to select it, the HTML elements around the select box will be selected, even though I do return false at the end of the mousedown event, which SHOULD normally cancel anything that comes after that (mouseup, click...), as well as prevent the default (this is where it seems not to be working.)
Obviously, Opera doesn't show this behavior. Haven't tested in other browsers.

I suppose no one has any idea how to come to terms with this..? And if it can't be fixed -- which is best? HTML selection after an item click, or select box getting closed after dragging the scrollbar thumb?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #76, on January 8th, 2012, 12:22 AM »
If you click and drag and go outside the element, deselect it.

Half the battle is simply because a selectbox normally operates outside the classical rendering (all its rendering is *totally* self contained and not accessible to the JS), I don't suppose it'd be any better operating as an iframe-type shim, would it?
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #77, on January 8th, 2012, 12:39 AM »
I should specify that the selection bug only happens when trying to 'drag' the text (copy it) at the moment you click it (which is unlikely to happen..?), while the 'select box closing itself' bug happens everytime your cursor ends up outside of the box.
Also, the selection bug can be 'reproduced' by simply trying to drag smileys in the smiley list (basically, LOTS of areas can reproduce the bug..), and it only happens in IE.

iframes? Over my dead body...!
(My only fear is that Wedge somehow has an obscure area where select boxes are manipulated dynamically in a way that they can't be found by doing a regex search on your project files. Then again -- if nobody uses said feature, it won't matter, and if someone does, they're bound to tell us what we should fix...)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #78, on January 8th, 2012, 12:44 AM »
Why not then attach:
Code: [Select]
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;

That would prevent it being selectable in a way that just munging the events won't.

The iframe suggestion was out of left field, and I didn't expect it to be taken seriously :P

The only dynamic select box I can think of is the jumpto, I can't think of a selectbox that's populated dynamically anywhere else in the source.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #79, on January 8th, 2012, 11:27 AM »
As I said, the issue only happens with IE (6/7/8, not 9), so even the -ms prefix would be useless because only IE10 supports it. I could use the unselectable property, but even then I don't want to complicate things.

There are two dynamic select boxes that I know of: the JumpTo, and the PM global label selector -- it takes a list of available labels, determines which selected PMs already have it, and recreates the "Add label" and "Remove label" entries accordingly. I rewrote the code to simplify it -- now it generates two optgroups, so it helps with readability, but obviously it still repopulates the box. I could have the box contain every single entry and then simply 'hide' them which would make it easier to re-create, but there's no point in doing that. And yes, if I implemented some kinds of tricks, I could get away with removing at least 200 bytes of code (possibly a bit more) from the select box, but I don't want to impair any plugins by forcing them to do tricks when it's so elegantly handled by my code.

Anyway, that's irrelevant to the issue at hand...

When I say 'dynamically', I really mind the simple fact of doing manipulations on select boxes without referring to them as select boxes.

Code: [Select]
<select id="hello">
  <option id="world" value="">Test</option>
</select>

Consider this:

Code: [Select]
$('select option[val=""]').val('Nyan nyan');

And this:

Code: [Select]
$('#world]').val('Nyan nyan');

They will both do the same thing... However, the second one forces me to go through every single select box in the code, take note of their IDs and their option IDs, and then go through the entire code again to search for possible manipulations. The point is, because SMF didn't use jQuery, and I didn't convert every single JS statement inside templates themselves, it's easier to do getElementById() on an option than going through getElementByTagName or something...
The problem is unlikely to happen in any non-admin pages, but the admin area... Some of its code is so convoluted... :-/
Re: Selectbox
« Reply #80, on January 8th, 2012, 12:32 PM »
(BTW, IE problem fixed half an hour ago. I'm telling you just in case you'd want to look into it. Should have posted earlier...)

MultiformeIngegno

  • Posts: 1,337
Re: Selectbox
« Reply #81, on January 8th, 2012, 03:17 PM »
You did a freakin great job BTW :o

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #82, on January 8th, 2012, 03:50 PM »
The admin area generally is a mess. Why do you think I wanted to torch it to the ground and start over?

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #83, on January 8th, 2012, 04:06 PM »
Yeah eheh.

Lorenzo, you haven't even seen the completed select box on the demo site ;)
I shall update it soon though... But I'm currently hooked on Steins;Gate. Great show for 'realistic time travel' fans. :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #84, on January 8th, 2012, 04:08 PM »
Could be worse, I've been hooked on playing with a 20 year old paint program that has features I've yet to see anywhere else (since I've been playing with pixel art for making canvas-based games)

MultiformeIngegno

  • Posts: 1,337
Re: Selectbox
« Reply #85, on January 8th, 2012, 04:11 PM »
Quote from Nao on January 8th, 2012, 04:06 PM
Lorenzo, you haven't even seen the completed select box on the demo site ;)
Can't wait to see it!! :cool:
It would be nice if in the footer of the demo site there was specified the "rev" that runs. Something like "Wedge rev 1242". :)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #86, on January 8th, 2012, 04:15 PM »
Hmm yeah I guess it's technically possible but it'd have to be done manually or we'd have to learn about svn a bit more. I remember looking into it...

Pete: Neochrome? deluxe Paint? Degas Elite? :P

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #87, on January 8th, 2012, 04:19 PM »
Whatever script pulls the files can just edit the version string... I don't think there's any more elegant way of doing that without reinstalling.

Oh, and Deluxe Paint on the Amiga :D

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #88, on January 8th, 2012, 05:27 PM »
Quote from Lurker on January 8th, 2012, 04:19 PM
Whatever script pulls the files can just edit the version string... I don't think there's any more elegant way of doing that without reinstalling.
changelog.txt's first line, SMF?
Quote
Oh, and Deluxe Paint on the Amiga :D
As expected!! :niark:

DEMO UPDATED TO 1242!
Posted: January 8th, 2012, 05:15 PM

BTW -- quickest way to see the awesomeness of the select box in action: menu > PM > Send message.
Just play with the three select boxes in the post/pm editor. They're HTML, two of them have a scrollbar (with the small hover effect), and it just works flawlessly. :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #89, on January 8th, 2012, 05:36 PM »
Quote
changelog.txt's first line, SMF?
Updated manually by the team. The amount of times they forgot to update it...