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

source tab view out gives "Uncaught TypeError: b is null in Firefox" #4782

Closed
ophian opened this issue Jul 2, 2021 · 5 comments · Fixed by #4800
Closed

source tab view out gives "Uncaught TypeError: b is null in Firefox" #4782

ophian opened this issue Jul 2, 2021 · 5 comments · Fixed by #4800
Assignees
Labels
plugin:autocomplete The plugin which probably causes the issue. regression This issue is a regression. status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@ophian
Copy link

ophian commented Jul 2, 2021

Does this happen with "normal" installation too? No, it does not. It is only part of my ckeditor plus implementation.

Type of report

Bug

Provide detailed reproduction steps (if any)

  • Open console.
  • Open basic or standard or full editor form
  • Either / or new form or edit an entry
  • Press source tab button and tab again to get out

Expected result

No error :)

Actual result

Firefox 89 (with lots of detail steps) throws: Uncaught TypeError: b is null. FF 90 says Uncaught TypeError: can't access property "isInline", b is null in updateAriaAttributesOnEditable function.
It does not seem to harm anything essential having this TypeError.
Chromium Version 93 does not have this issue.

if I change b.isInline() in

addAriaAttributesToEditable:function(){var a=this.editor.editable(),b=this.view.element.getAttribute("id");a.isInline()&&(a.setAttribute("aria-controls",b),a.setAttribute("aria-activedescendant",""),a.setAttribute("aria-autocomplete","list"),a.setAttribute("aria-expanded","false"))},updateAriaAttributesOnEditable:function(a){var b=
this.editor.editable();a=a.data;b.isInline()&&(b.setAttribute("aria-expanded",a?"true":"false"),a||b.setAttribute("aria-activedescendant",""))},

to (b?b.isInline():null) as

addAriaAttributesToEditable:function(){var a=this.editor.editable(),b=this.view.element.getAttribute("id");a.isInline()&&(a.setAttribute("aria-controls",b),a.setAttribute("aria-activedescendant",""),a.setAttribute("aria-autocomplete","list"),a.setAttribute("aria-expanded","false"))},updateAriaAttributesOnEditable:function(a){var b=
this.editor.editable();a=a.data;(b?b.isInline():null)&&(b.setAttribute("aria-expanded",a?"true":"false"),a||b.setAttribute("aria-activedescendant",""))},

the error is gone and all seems to work well.
I can't say where this error originates from.

This is my custom config:
https://github.com/ophian/additional_plugins/blob/master/serendipity_event_ckeditor/cke_config.js

Other details

  • Browser: FF 89 and FF 90 (in my plugin version of CKE in both)
  • OS: Win and Linux
  • CKEditor version: 4.16.1
  • Installed CKEditor plugins: codesnippet and more (- I don't think this is reproducible for others without using my Styx environment.)

If someone with more insight could lead me on this, I would be happy. Maybe this null check in ckeditor is officially a need or not, or how to rewrite my configuration to not have this error thrown. Thank you!

@ophian ophian added the type:bug A bug. label Jul 2, 2021
@Comandeer
Copy link
Member

Comandeer commented Jul 2, 2021

It can be reproduced in "normal" CKEditor by adding emoji plugin to the editor: https://jsfiddle.net/ojay8kv1   

It's connected with changes introduced in #4637, especially the code that adds ARIA attributes to the editable. For some reason it seems to run in Firefox before editable is fully initialised after switching back to WYSIWYG mode.

@Comandeer Comandeer added plugin:autocomplete The plugin which probably causes the issue. regression This issue is a regression. status:confirmed An issue confirmed by the development team. labels Jul 2, 2021
@ophian
Copy link
Author

ophian commented Jul 2, 2021

Oh Thanks. So there is a chance I just have to wait for an official fix. 😄

Just as a sidenote. My Serendipity Styx Blog environment has a basic ckeditor in core also with emoji added. This one does not throw this typeError. So perhaps it is also autocomplete? Its CKBUILDER_CONFIG loads plugins : {
'about' : 1,
'autogrow' : 1,
'basicstyles' : 1,
'blockquote' : 1,
'clipboard' : 1,
'codesnippet' : 1,
'emoji' : 1,
'enterkey' : 1,
'entities' : 1,
'floatingspace' : 1,
'htmlwriter' : 1,
'indentlist' : 1,
'link' : 1,
'list' : 1,
'magicline' : 1,
'mediaembed' : 1,
'sourcearea' : 1,
'specialchar' : 1,
'toolbar' : 1,
'undo' : 1,
'wysiwygarea' : 1
},

@Comandeer
Copy link
Member

Yes, the issue originates from autocomplete plugin, but it requires that an autocomplete instance is created and bound to the editor. The emoji plugin does it – it uses autocomplete internally to create an emoji picker.

I created an editor with plugins you mentioned above and it seems that the bug is also present in such a case: https://jsfiddle.net/eg7c4wnz/

@f1ames f1ames added the size:S label Jul 13, 2021
@f1ames f1ames added this to the 4.16.2 milestone Jul 15, 2021
@sculpt0r sculpt0r self-assigned this Jul 23, 2021
@sculpt0r
Copy link
Contributor

Our aria updates happens when our textwatcherdetects unmatched text. It leads to close() in autocomplete, which causes disabling model, which fires change-isActive, which is bonded to our aria updater... 😅

In FF this is happening right after reseting editable to null (due to mode change). In other browsers, right after the reseting, the editable is able to recreate and then our aria updater is invoked.

@CKEditorBot
Copy link
Collaborator

Closed in #4800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin:autocomplete The plugin which probably causes the issue. regression This issue is a regression. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants