-
Notifications
You must be signed in to change notification settings - Fork 779
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
feat: deprecate and replace dom.isVisible, utils.isHidden, and dom.isHiddenWithCss #3351
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The direction looks fine. I left some suggestions on refactoring this to make the logic of which method does what a little more explicit. Obviously I'd like to see tests added to this.
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
All comments about changing things outside of the refactor captured here #3655 |
So although I converted the functions to use options, I don't think foo = axe.utils.memoize(function(a, { b }) {
console.log('here', {a, b})
return true
})
foo(1, {b: 2}) // here {a: 1, b: 2}
foo(1, {b: 2}) // here {a: 1, b: 2} Which shows that the memoized function is not be cached as the options object is not strictly equal for the cache to trigger. We may not be able to do options after all. |
@@ -0,0 +1,171 @@ | |||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disagree. I'm uncomfortable when we do it just for pulling a method into its own file. With whole new methods I think we need to make the effort. These are easy tests to write. Let's just get them done.
Also remember to open an issue for those questionable uses of isVisible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple minor points
axe._thisWillBeDeletedDoNotUse.commons = | ||
axe._thisWillBeDeletedDoNotUse.commons || {}; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom = | ||
axe._thisWillBeDeletedDoNotUse.commons.dom || {}; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.nativelyHidden = nativelyHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.displayHidden = displayHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.visibilityHidden = visibilityHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.ariaHidden = ariaHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.opacityHidden = opacityHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.scrollHidden = scrollHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.overflowHidden = overflowHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.clipHidden = clipHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.areaHidden = areaHidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting messy. Lets pull this into a separate file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to the tech debt ticket #3655 (cleaning it up properly is out of scope for this pr as this object is in multiple places throughout the lib
code base)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR is increasing tech debt. That's not out of scope. But fine, under protest.
axe._thisWillBeDeletedDoNotUse.commons = | ||
axe._thisWillBeDeletedDoNotUse.commons || {}; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom = | ||
axe._thisWillBeDeletedDoNotUse.commons.dom || {}; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.nativelyHidden = nativelyHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.displayHidden = displayHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.visibilityHidden = visibilityHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.ariaHidden = ariaHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.opacityHidden = opacityHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.scrollHidden = scrollHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.overflowHidden = overflowHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.clipHidden = clipHidden; | ||
axe._thisWillBeDeletedDoNotUse.commons.dom.areaHidden = areaHidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR is increasing tech debt. That's not out of scope. But fine, under protest.
A precursor to fixing #2806 and #3532.
Closes #3617