Drupal has for years had a Javascript dohicky to allow selected textareas to be resized in the browser with a draggable handle. You have probably seen one. :-)

There is an open issue to replace it with a more standard jQuery UI library, which I fully support: #1138258: Drop textarea.js in favor of CSS3 resize

However, a number of browsers now offer their own built-in resizers natively. Firefox 4 does, and I understand at least some WebKit browsers do as well. It seems redundant to have two resizing handles in those browsers, plus it adds JS weight to the page. (We have to insert the image, hook up the events, etc.)

If we can detect whether or not the browser is adding a resizer already, we should do so and then just let the browser take care of it if so, bypassing JS completely. I'm not entirely sure how to do that, however. I defer to one of our front-end gurus.

IMO this should be implemented in Drupal 8 and backported to Drupal 7. I'm also filing it separately from the issue above as it's technically a separate issue, but if the front-end folks feel it's better to handle it together go ahead and mark this as a duplicate.

CommentFileSizeAuthor
#11 gripped.patch2.95 KBrobloach
#9 releasie.patch3.11 KBrobloach

Comments

Crell’s picture

Tagging with the best tag ever.

robloach’s picture

I guess we could use the CSS resize property along with min-width, and just leave it to the browser to figure out how to handle that. Here's a demonstration on that (why write JS when you don't have to).

Do we really need the Grippie? I have a feeling that people are more use to what their browser/operating systems offers (with the CSS resize property) than this little grippie design that we came up with.

Trying not to bikeshed: Also note that Autoresizing textareas are another useful usability enhancement that's become more popular lately. Maybe a combo of both?

tstoeckler’s picture

Looks pretty smooth in FF4... :)

bryancasler’s picture

+1 for auto expanding

Crell’s picture

I'm not sure of auto-expanding textareas, as those have limitations too. At minimum, though, "don't do work the browser already does for you" is a nice bite-sized task that we should definitely do. I hadn't heard of that CSS property before, but now that I have I really like it. :-)

How do we detect if a browser is able to leverage that CSS property?

bryancasler’s picture

Just dropping this here for everyone to reference http://www.w3.org/TR/2004/CR-css3-ui-20040511/#resizing

larowlan’s picture

+1 for auto expanding with reasonable limits

wmostrey’s picture

Porting the "Not Invented Here" tags over to "Proudly Found Elsewhere"

http://twitter.com/#!/RobLoach/status/68655395543060481

robloach’s picture

Component: base system » forms system
Status: Active » Needs review
Issue tags: +Less code
StatusFileSize
new3.11 KB

Here's a patch to remove it, and use CSS resize instead. If we want to keep it, then we should head over to #1138258: Drop textarea.js in favor of CSS3 resize.

Status: Needs review » Needs work

The last submitted patch, releasie.patch, failed testing.

robloach’s picture

Status: Needs work » Needs review
StatusFileSize
new2.95 KB

Grr, the bot can't deal with binary deletions.

  1. Apply patch
  2. Delete grippie.png
tstoeckler’s picture

Also remove core/misc/textarea.js

robloach’s picture

Status: Needs review » Needs work

Yeah, let's fix that with format-patch.

nod_’s picture

Issue tags: +JavaScript clean-up

This is really nice, I hate grippie so much. Might want to use resize: vertical to be closer to what grippie does.

I'm not a git wizard so I'll wait a bit to see if someone else is more conformable rerolling this.

nod_’s picture

Looks like there is a way to know if a browser supports resize or not:
$('<textarea>').css('resize', 'vertical').appendTo('body').css('resize')
This returns 'vertical' in supported browsers and an empty string if it can't handle it (try with opera). It has to be added to the body for styles to be interpreted.

nod_’s picture

The patch over there #1138258: Drop textarea.js in favor of CSS3 resize implements resize with CSS and fallback to jquery ui for browsers not supporting it (opera for example).

robloach’s picture

Status: Needs work » Closed (duplicate)