Skip to content

Can't enter text in textarea#2063

Merged
adumesny merged 1 commit into
gridstack:v6from
adumesny:v6
Oct 9, 2022
Merged

Can't enter text in textarea#2063
adumesny merged 1 commit into
gridstack:v6from
adumesny:v6

Conversation

@adumesny

@adumesny adumesny commented Oct 9, 2022

Copy link
Copy Markdown
Member

Description

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

* fix for gridstack#2054
* make sure to prevent mousedown handling over known list of tags (like jqueryui did)
@adumesny adumesny merged commit a80857a into gridstack:v6 Oct 9, 2022
@Gezdy

Gezdy commented Nov 1, 2022

Copy link
Copy Markdown

For @adumesny
Element with [contentEditable="true"] has the same issue. So, suggested code completion:

// make sure we are not clicking on known object that handles mouseDown (TODO: make this extensible ?) #2054
const skipMouseDown = ['input', 'textarea', 'button', 'select', 'option'];
const name = e.target.nodeName.toLowerCase();
if (skipMouseDown.find(skip => skip === name))
        return true;

//for contenteditable
if(e.target.closest('[contenteditable="true"]')){        	
        return true;
}

Further away in the same function _mouseDown, just before returning

e.preventDefault();
dd_manager_1.DDManager.mouseHandled = true;
return true;

e.preventDefault() prevents blur event which occurs just after mousedown event.
So, skipped elements here will continue to have focus when dragging.
Suggested solution:

if (document.activeElement){
     document.activeElement.blur();
}
e.preventDefault();
dd_manager_1.DDManager.mouseHandled = true;
return true;

Thx a lot for all your great work !

@adumesny

adumesny commented Nov 1, 2022

Copy link
Copy Markdown
Member Author

do you want to make a pull request instead ? thanks.

Gezdy pushed a commit to Gezdy/gridstack.js that referenced this pull request Nov 1, 2022
adumesny added a commit that referenced this pull request Nov 13, 2022
bug #2063: editable elements focus and blur correction
adumesny added a commit to adumesny/gridstack.js that referenced this pull request Feb 11, 2023
* had incorrectly commented out code that only allowed dragging by the specified handle in gridstack#2063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants