question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blur event fires when using controls in the toolbar

See original GitHub issue

I believe this is a bug as the onBlur event should only fire when the wysiwyg loses focus…meaning when the user moves on to another form element. Any actions within the editor window should not be considered as a blur event.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
Yahasanacommented, Jan 22, 2019

@bartcoppens there is bug when click between two editors

if ($(event.relatedTarget).closest('.note-editor').length === 0) {
  _this.context.triggerEvent('editorfocusout', event);
}

after some investigations, here is a solution

  onBlur: function(e) {  
    var p = e.target.parentNode.parentNode;
    if (! (e.relatedTarget && $.contains(p, e.relatedTarget))) {
      // real blur the editor and what r u goin to do now
    }
  }

PS: feature for auto toggle toolbar on focus and blur

callbacks: {
  onInit: function(e) {
    e.toolbar.addClass('d-none')
  },
  onFocus: function(e) {
    $(e.target.parentNode.parentNode).find('.note-toolbar').removeClass('d-none');
  },
  onBlur: function(e) {
    var p = e.target.parentNode.parentNode
    e.relatedTarget && $.contains(p, e.relatedTarget)||$(p).find('.note-toolbar').addClass('d-none')
  }
}
5reactions
artknightcommented, Apr 30, 2018

@DiemenDesign @hackerwins @easylogic I am OK with adding a separate trigger like onCompleteBlur or something along those lines that gets triggered when the editor ( including the toolbar ) completely loses focus.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tinyMCE 3.5 blur event fires when toolbar buttons are clicked
I've been trying to use the following method to capture when a tinyMCE field is blurred as has been mentioned in numerous SO...
Read more >
Window: blur event - Web APIs | MDN
The blur event fires when an element has lost focus. The opposite of blur is focus . This event is not cancelable and...
Read more >
OnBlur event fires when page loads - Telerik Forums
Hi, I try to use the RadMaskedTextbox, but I run into several issues. Because I use several RadMaskedTextboxes in one user control and...
Read more >
Blur and focus fired when opening/closing dialogs - CKEditor
I'm seeing the blur event firing when I click on the toolbar itself (not one of the buttons/controls within it), and also when...
Read more >
Blur not firing in an Angular app when filled with 1password
I have an Angular javascript website front end with a username and password field, and the username (email) has a blur event on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found