Thanks to visit codestin.com
Credit goes to github.com

Skip to content

JS error on pages where .kv-fileinput-caption does not exist #455

@alexmerlin

Description

@alexmerlin

Issue:

The code looks for the HTML element .kv-fileinput-caption and when it does not find it, the below error is shown in the console.
The error happens on all pages, except for /account/avatar where the element actually exists.

Uncaught TypeError: Cannot read properties of null (reading 'style') at HTMLDocument. (app.js:1:1279)

Issue location:

https://github.com/dotkernel/frontend/blob/5.0/src/App/assets/js/components/_avatar.js#L45

let captionInput = document.querySelector('.kv-fileinput-caption');
captionInput.style.height = '86px';
captionInput.style.marginTop = '33px';

Solution:

Check if the object captionInput is not null before trying to access it on the following lines.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions