Having editable fields set to focus via the JS automatically drops the page down to the first field upon loading the page. This is really annoying from a user perspective. The attached patch removes the functionality. I'd highly suggest this becomes a toggleable setting in future releases.

CommentFileSizeAuthor
editablefields-removeFocus.patch454 bytesmstef

Comments

markfoodyburton’s picture

janvandiepen added it, but - I am not at all sure I understand why?

http://drupalcode.org/viewvc/drupal/contributions/modules/editablefields...

I wonder if it was there for testing purposes initially?

Maybe we should simply remove it altogether?

Hopefully Jan can comment...

Cheers
Mark.

Jan van Diepen’s picture

To be honest, I hadn't even noticed it and it was certainly not done on purpose.
The 3 lines of code were put there to replace some code (also used for focusing) in Drupal.editablefields.init and Drupal.editablefields.load.

See: http://drupalcode.org/viewvc/drupal/contributions/modules/editablefields...

The focusing was originally added to solve issue #556194: Fields not showing if value doesn't exist. by giving an empty field focus after clicking its label.
If removing the 3 lines of code will not break the intended focusing/blurring behavior of the fields, then please go ahead and remove it permanently.

Appreciate the feedback though. So thanks for that mikestefff.

markfoodyburton’s picture

Mikestefff, can you give this a good test and report back?

Cheers

Mark.

mstef’s picture

What exactly am I testing? If an empty field like a text box still appears without focusing? I don't see how calling focus() on an element would affect that.

markfoodyburton’s picture

I dont know ! - Jan?

Jan van Diepen’s picture

Sorry for not responding earlier.

We need the focusing (and blurring) behavior for the implementation of collapsing fields. The label was made click-able to allow focus to be set to an empty (invisible) field that goes with it.

The original code that was used to do the focusing was removed from Drupal.editablefields.html_init() and Drupal.editablefields.load() and replaced by some code in Drupal.behaviors.editablefields() in editablefields.js. Drupal.behaviors is a funny thing. In our case it should attach (but not execute) the focusing behavior to the editablefields on initialisation. Somehow it also executes that behavior on a page when opening it, hence the displacement.

What should be tested is if the patch that removes the initial displacement does not change the intended behavior of focusing and blurring needed for collapsing the fields. So run some tests with and without the patch and see if the behavior, with the exception of the initial displacement, has not been changed.

mstef’s picture

I really don't know what you're talking about...sorry

mstef’s picture

I see the latest release did not include this patch...

Everyone I know using editablefields uses this patch. Without it, this module really ruins the UI. Every page load, the pages automatically drop to the last input widget.

What's going to happen with it?

henrijs.seso’s picture

+1 was about to post issue. thanks for patch!

rkeppner’s picture

I'd like to see this patch get committed or the lines removed, either way. What can I do to help the process along?

mstef’s picture

Yea the patch just comments them out for now. I figured I'd let the maintainer decide what should be done with them.

rkeppner’s picture

Category: feature » bug

I'm changing the category from feature request to bug report, since this seems like an actual problem with existing functionality, not a request to improve existing functionality. Please change it back if I'm wrong in this assumption.

My use case makes this "bug" rather egregious. I'm only using click to edit formatters, so the focus gets passed beyond the editable fields to the next form field on the page (which is actually half-way down the page from the editable fields), totally confusing users.

I'd really like to see this patch make it in. Or I could roll a new one that simply removes the lines in question, if that method is preferred.

What needs to be tested to ensure that this doesn't break things?

Anonymous’s picture

Title: Setting Editablefields to Focus Ruins UX » Setting Editablefields to Focus ruins UX
Status: Active » Needs review

Patch works for me.

I've set a date field (with popup) as editable. The focus was put on the date field and so a blinking cursor was shown there (which was annoying), but also prevented the popup appearing without first clicking off the field (blur), then back on again (focus).

Not using collapsible fields though...

aaronschachter’s picture

works for me too!

peamik123’s picture

Is there any likelyhood of this patch being released as a new version of editablefields please?

I've just hit the same problem, and the patch works for me also. But I am not confortable with the concept of live sites running for long periods with patched code, in case a later release comes along that doesn't include the patch.

Thanks

mstef’s picture

I can roll a new one if you want. This patch just comments out the code that causes this issue. It's probably best, if the maintainers agree to take this, to just completely remove it.

mry4n’s picture

I cloned branch 6.2.x: http://drupal.org/node/165016/git-instructions/6.x-2.x

I downloaded the patch and applied it, but I got this error msg:

$ git apply -v editablefields-removeFocus.patch
Checking patch editablefieldsNew.js...
error: editablefieldsNew.js: No such file or directory

Help me Obi Wan. You're my only hope.

mry4n’s picture

OK, I found the lines that needed to be commented out in editablefields.js, and just did so manually. Although, it's my understanding that the patch needs to apply properly in order to be committed. True?

mstef’s picture

I think at this point, we're all aware of what the issue is. Like you said, there's only three lines (or so) lines that shouldn't be there, so a patch isn't really needed. The patch I attached is old, and only comments them out rather than remove them. I can roll a new one, if needed.

mry4n’s picture

Status: Needs review » Reviewed & tested by the community

OK, this thing works! Thank you. Bringing the focus down to the bottom of the page was driving me batsh*t crazy.

Now... what's a guy gotta do to get a patch committed around here?

From what I see above it's been tested numerous times, and there's no reason the code that is commented out can't be taken out completely....?

mstef’s picture

+1

I'm not sure why those lines were added in the first place. Seems a bit forthcoming to throw the user directly at a given field whenever a page is loaded.

mry4n’s picture

I assume that changing the status to "reviewed & tested by the community" is all we need to do at this point. Now we just wait for the maintainers to get through their backlog of patches. At least that's what I gather from here http://drupal.org/node/332678 .

If someone knows of something else we need to do, please post.

andreiashu’s picture

Version: 6.x-2.0 » 6.x-2.x-dev
Status: Reviewed & tested by the community » Fixed

Hi,

Thanks for testing and for the patch itself and sorry for such a late commit.

I've removed the lines where we were focusing and also gave credit to mikestefff.

Thanks,
Andrei

mstef’s picture

Nice!

Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.