Problem/Motivation
Currently, the opacity of textareas that are being resized is set directly in the JS. This means themes cannot override it.
Proposed resolution
Instead of setting the opacity, set a CSS class .dragging
. Provide default CSS for this class to match the current styling, which can then be overridden by themes,
#835820-30: Don't set CSS directly in JS, make it themable provides this fix rolled against the current D8 codebase. The CSS in this patch is confirmed to work in:
- FF3 (Windows)
- Opera 9 (Windows)
- IE6
- FF (OS X)
- Chrome (OS X)
- Safari (OS X)
IE CSS is included alongside standard CSS. Documentation at https://developer.mozilla.org/en/CSS/opacity confirms the solution used is correct for IE and modern browsers. See #835820-23: Don't set CSS directly in JS, make it themable.
Remaining tasks
None.
User interface changes
None.
API changes
New CSS class (.dragging
). Not sure if that counts. :)
Original report by @alippai
textarea.js sets opacity directly in JS instead of adding CSS class and setting that opacity value in CSS
Added D7 and D6 patches too.
Comment | File | Size | Author |
---|---|---|---|
#30 | 835820-30-textarea-opacity-with-ie6.patch | 1.11 KB | xjm |
#24 | 835820-19-textarea-opacity-with-ie6_0.patch | 1.05 KB | RobLoach |
#19 | 835820-19-textarea-opacity-with-ie6.patch | 1.05 KB | idflood |
#17 | 835820-16-textarea-opacity-with-ie6-reroll.patch | 1.04 KB | idflood |
#10 | 835820-10-textarea-opaciy-withie6.patch | 1.31 KB | Pasqualle |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedMakes sense. Rerolled as a proper patch.
Comment #2
alippai CreditAttribution: alippai commentedComment #3
alippai CreditAttribution: alippai commentedsry, crossposted
Comment #4
jhodgdonThis seems like quite a reasonable change....
But can someone clue me in as to where this is used in the core UI, so I'd have a chance at testing to see if it still works as it should (i.e. that it is somewhat transparent while it's being dragged)? I'm not sure what dragging a text area would mean, or where this is being used.
Comment #5
Damien Tournoud CreditAttribution: Damien Tournoud commented@jhodgdon: That's the whole textarea being set transparent when the resize handle is used.
Comment #6
jhodgdonIn Firefox 3.x (Windows and Linux), I have verified that this works as intended after the patch, on a Node Add page. Using Firebug, I also made sure that the patched JS was actually being called.
The patched site also works as intended in Opera 9 on Windows.
However, I also tried in in Internet Explorer 6. In IE6, the old code worked correctly (the text area went dim while I was resizing), and this new code doesn't (the text area stays as it was). I am not sure why, or if anyone cares about IE6 (I only keep it around for testing purposes), but it is a regression.
Comment #7
alippai CreditAttribution: alippai commentedIn jQuery 1.4:
In jQuery 1.2.6 (for D6):
I have to implement theese in CSS (set the zoom and the alpha filter).
Comment #8
alippai CreditAttribution: alippai commentedComment #10
Pasquallereplaced windows style line ends
Comment #11
jhodgdonYeah. Apparently IE uses filter rather than opacity as the CSS (apparently, opacity was not a CSS standard until CSS 3, so browsers rolled their own standard). For reference:
http://www.w3schools.com/Css/css_image_transparency.asp
Anyway, I think it could be useful to put a comment in the CSS about why both of those are needed? And are IE fixes supposed to be in the main system CSS file or in an IE-specific file?
So... Those details aside, I have tested this in FF 3/Win, Opera 9/Win, and IE6, and it now works.
Comment #12
alippai CreditAttribution: alippai commentedWho should decide on this? Gabor and webchick?
Comment #13
jhodgdon#10: 835820-10-textarea-opaciy-withie6.patch queued for re-testing.
Comment #15
jhodgdonLooks like this needs a reroll, and maybe something to address #11?
Comment #17
idflood CreditAttribution: idflood commentedsimple reroll of patch in #10. The question about seperate css for ie remains. ( only tested with firefox, chrome and safari on osx )
Comment #18
alippai CreditAttribution: alippai commentedhttp://www.quirksmode.org/css/opacity.html - IMHO we need to test (and maybe extend) functionality for IE8. Tomorrow I'll check it.
Comment #19
idflood CreditAttribution: idflood commentedThe css code provided by the patch should be enough, according to https://developer.mozilla.org/en/CSS/opacity .
There was a missing space and I also reordered the attributes to match the given reference.
Comment #20
pfrenssenI just checked if the IE-specific fixes should be in a separate file or not. I suppose not as I found another IE-specific fix in a 'regular' css file. This is part of modules/toolbar/toolbar.css:
Another thought: is it a good idea to provide both the 'filter' and '-ms-filter' statements as is done here in toolbar.css? I guess this is in there for compatibility reasons.
Comment #21
RobLoachI'd consider this RTBC. Not sure how it impacts the IE issue that was mentioned above though.
Comment #22
jhodgdonNeeds to go to d8 and then d7
Comment #23
aspilicious CreditAttribution: aspilicious commentedThe IE-specifc cases should be in the same file.
According to the mozille pages: (I trust them :) )
- IE supports also the extended form progid:DXImageTransform.Microsoft.Alpha(Opacity=xx). This is needless, so don't use it.
- IE8 introduced -ms-filter, synonymous with filter. Don't use the -ms- prefix.
- Similar to -moz-opacity, -khtml-opacity is dead as well since early 2004 (release of Safari 1.2).
- Konqueror never had support for -khtml-opacity and uses opacity since version 4.0.
- Don't use -khtml-opacity nor -moz-opacity anymore.
I don't think this needs a comment. Maybe a link to https://developer.mozilla.org/en/CSS/opacity could help but I don't link to put external links into core.
So this sounds good to go :)
Comment #24
RobLoachTest bot?
Comment #25
tstoecklerLooks good.
Comment #26
RobLoachRelated: #1138258: Drop textarea.js in favor of CSS3 resize
Comment #27
catchTagging for backport.
Comment #28
xjm#24: 835820-19-textarea-opacity-with-ie6_0.patch queued for re-testing.
Comment #30
xjmRerolled against current D8 codebase; no changes. Back to RTBC.
Comment #31
xjmAdded issue summary.
Comment #32
droplet CreditAttribution: droplet commentedIs that textarea.js a part of FAPI ? I see all other JS have own comments with the css.
and don't you think .textarea-dragging is more better.
Comment #33
xjmCould you clarify?
I agree that
.textarea-dragging
is a more specific and clear class name. If anyone who participated in the issue earlier agrees, let's reroll it with that name. Should still be RTBC either way.Comment #34
droplet CreditAttribution: droplet commentedIt should be something like:
http://drupalcode.org/project/drupal.git/blob/refs/heads/8.x:/modules/sy...
Comment #35
sun@droplet is right. Also changing the component to make the right people aware of this issue.
Lastly, I'm not sure whether this can be backported. The purpose of system.theme.css is to be overridden by themes. (but putting that CSS into system.theme.css is valid)
Comment #36
droplet CreditAttribution: droplet commentedD8 dropped: #1138258: Drop textarea.js in favor of CSS3 resize
Comment #36.0
droplet CreditAttribution: droplet commentedUpdated issue summary.
Comment #37
mgiffordComment #38
brahmjeet789 CreditAttribution: brahmjeet789 commentedI think @droplet is right.that the issue name should be interrelated with the issue so that people should awre of the type of issue that is what is the issue?
Comment #39
R13ose CreditAttribution: R13ose commented