ember-a11y / ember-a11y-testing

A suite of accessibility tests that can be run within the Ember testing framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

performance enhancement- requestIdleCallback?

MelSumner opened this issue · comments

requestIdleCallback supports queuing a function to be called when the browser is idle. (https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback)

Could this be used to increase the performance of the ember-a11y-testing addon?

My two cents: This may be beneficial for the audit running within the application during development, but not for the testing environment.

For tests, we want it to be synchronous so that we are actually checking the DOM state that the user had intended to check. During development though, this seems more like a background task that doesn't necessarily need to block.

@trentmwillis what's a good way to separate testing vs development?

Well currently we have the per-component audit, that only runs in development (not in testing mode):

if (this.turnAuditOff || Ember.testing) { return; }

And then in tests, we have the a11yAudit helper.

@MelSumner I think we should close this ticket out due to staleness. My 2 cents: somewhat averse to using this as it's still an experimental feature. This would also be tricky to integrate with tests due asynchronicity outside of the event loop. Could also conflict with the scheduler I setup to make axe-core work correctly with multiple component renders. requestIdleCallback seems to lend itself better for background-centric tasks such as fetch request and such, not so much for running a11y audit and UI updates.