Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't enter text in textarea #2063

Merged
merged 1 commit into from Oct 9, 2022
Merged

Can't enter text in textarea #2063

merged 1 commit into from Oct 9, 2022

Conversation

adumesny
Copy link
Member

@adumesny adumesny commented Oct 9, 2022

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
Copy link

Gezdy commented Nov 1, 2022

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
Copy link
Member Author

adumesny commented Nov 1, 2022

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.

None yet

2 participants