Skip to content

suppress some chrome violation warnings#16547

Closed
wkpark wants to merge 1 commit intoAUTOMATIC1111:devfrom
wkpark:passive_true
Closed

suppress some chrome violation warnings#16547
wkpark wants to merge 1 commit intoAUTOMATIC1111:devfrom
wkpark:passive_true

Conversation

@wkpark
Copy link
Copy Markdown
Contributor

@wkpark wkpark commented Oct 12, 2024

Description

  • add {passive: true} option the addEventListener() to suppress chrome violation warnings.

See also: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#passive

Checklist:

…rnings

e.g.) [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive
@wkpark wkpark requested a review from AUTOMATIC1111 as a code owner October 12, 2024 11:48
Copy link
Copy Markdown
Collaborator

@w-e-w w-e-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a web dev so I'm not going to pretend that I know what are chrome violation warnings and passive event listener
all I can say is that
based on the console logs I see this when I use scrool wheel to change brush size

zoom.js?1729383118.4002457:810 Unable to preventDefault inside passive event listener invocation.
targetElement.addEventListener.passive @ zoom.js?1729383118.4002457:810

for my limited knowledge this prevents suppressing default functions of the action like they scroll wheel when changing brush size or right click context menu on gen button

vase on the doc you linked

passive
A boolean value that, if true, indicates that the function specified by listener will never call preventDefault(). If a passive listener calls preventDefault(), nothing will happen and a console warning may be generated.

so I'm not sure why you would want to use this as we explicitly uses preventDefault() in that event

@w-e-w w-e-w marked this pull request as draft October 20, 2024 00:23
@wkpark
Copy link
Copy Markdown
Contributor Author

wkpark commented Oct 20, 2024

image
this is full log when webui starting

@w-e-w w-e-w mentioned this pull request Oct 22, 2024
4 tasks
@w-e-w
Copy link
Copy Markdown
Collaborator

w-e-w commented Oct 22, 2024

@w-e-w w-e-w closed this Oct 22, 2024
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