Monday, July 11, 2005

text selection in internet explorer

this morning dj empirical sent me an email about a puzzling experience he had when he was viewing my blog in ie6 and tried to select some text: no matter where he would try to click & drag, the highlighted selection area would start at the very top of the page. as you could imagine, this behavior makes it pretty difficult to do any text excerpting, block quoting, etc.

i'd never noticed this behavior, because i avoid IE whenever possible: it's crap, and i've been so spoiled by firefox that i could never go back to something as awful as ie6. (i use it for browser testing, but basically i just load the page to make sure it renders properly and the mouseovers work, etc. i hadn't thought to include text selection in my browser testing regimen.) and in fairness, dj empirical knows better than to use IE also, but was in an environment where he had no choice but to use it. i checked some other pages, and the same thing was happening in IE on montana & mcdeviltoast (which i designed) and syntax's blog (whose stylesheet i recently rewrote, to strip it down and to fix an unusual layout problem in IE). these pages all behave perfectly in firefox.

after some intensive googling i found the source of the problem: a bug in IE involving how it renders pages that use absolute positioning. internet explorer has more bugs inside it than oogy boogy, so that's not a surprise.

i found a couple workarounds. this one suggests removing the DTD URI from the !doctype tag (that is, delete "http://www.w3.org/TR/html4/loose.dtd" from your !doctype tag). that seems to work for my blog, and it's the easiest fix, so that's the one i'm implementing. but in case that doesn't work for you for some reason, there's a javascript at the bottom of this page that you can insert into your <head> section, and it seems to work pretty well.

4 comments:

djempirical said...

sweet.

thanks, blood.

arratik said...

ya know, i noticed that too - but i wasn't having any problem viewing it at work (where we're required to use ie6) until our i.t. department went around and installed sp2 on everyone's computer during the shutdown last week. THEN the bugs came out to play. and i.t. is taking THIS week off, when all of the problems started... pfeh

djempirical said...

tried it out... i think it didnt fix things.

oh well, i'll examine it more later.

stAllio! said...

the second workaround (the javascript) will work for you.