Improve Accessibility Panel#87
Conversation
lib/accessibility-element-view.js
Outdated
| evt.preventDefault() | ||
| chrome.devtools.inspectedWindow.eval( | ||
| "inspect($$(\"" + this.path.replace('"', '\\"') + "\")[0])", | ||
| function(result, isException) { } |
There was a problem hiding this comment.
There is a internal helper that is promise-based instead of callback-based you might want to use here.
https://github.com/electron/devtron/blob/master/lib/eval.js#L4
There was a problem hiding this comment.
Oops, I missed that 😊 . Fixed
This is great 👍
Is the path forward here to open up a pull request upstream to make this a public API? |
This way axs can be built from npm _and_ be available to execute in the browser
|
Thanks! Yes, that might work but... the method generates selectors for an element and seems to only be used internally to generate error messages. Before creating an Issue, I thought I'd solicit feedback on an approach that does not require exposing I just pushed a commit (7f1d782) that is more accurate than relying on a generated CSS selector. It is also similar to how react-devtools solved the same problem. If that strategy seems convoluted or more difficult to maintain I submitted Getting access to the package in the browserI was unable to get the electron app access to // This code does not work
exports.audit = () => {
return Eval.execute(function () {
// This code is serialized and runs in the browser.
// It currently relies on the content_scripts in manifest.json to get access to axs via the window.__devtron.axs global
const axs = require('accessibility-developer-tools')
const config = new axs.AuditConfiguration({showUnsupportedRulesWarning: false})... I added There is probably a better way that I missed, but I could not figure it out. |
| @@ -0,0 +1,8 @@ | |||
| // This defines globals that will be used in the browser context | |||
There was a problem hiding this comment.
I think the filename here should be browser-globals.js to match the naming convention of the other files in this project.
|
Really cool, thanks for this 👍 |
|
Published in 1.4.0 🎉 |
|
This seems kinda blog-worthy. |
Thanks for adding tools to help make electron apps more accessible!
I stumbled upon this while fixing accessibility-developer-tools#291 and as a long-time Atom user/hacker, thought I'd leave this repository a little better off than how I found it.
TODO
accessibility-developer-toolsmodule instead of usingvendor/axs.jsaccessibility.jsuses a private function namedaxs.utils.getQuerySelectorText(element)