Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix(types): update accessibility types to match React's #1087

Merged
merged 6 commits into from
Mar 21, 2019

Conversation

layershifter
Copy link
Member

This PR fixes accessibility types.

}

export interface AccessibilityAttributes extends AriaWidgetAttributes, AriaRelationshipAttributes {
role?: AriaRole
tabIndex?: string
tabIndex?: number
Copy link
Member Author

Choose a reason for hiding this comment

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

@layershifter layershifter added 🚀 ready for review 🧰 fix Introduces fix for broken behavior. labels Mar 21, 2019
'aria-haspopup'?: string
'aria-hidden'?: string | boolean
'aria-invalid'?: string
'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'
Copy link
Contributor

Choose a reason for hiding this comment

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

could you, please, point to the React type that this prop's type has been taken from? Asking just because it would be much better if this kind of relationship (React prop's type for accessibility's type) would be explicit

Copy link
Member Author

Choose a reason for hiding this comment

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

HTMLAttributes: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L1475
Do you want to leave there a comment with this type?

Copy link
Contributor

Choose a reason for hiding this comment

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

@kuzhelov by explicit, do you mean a compile time dependency on React? Please note that behaviors should be plain javascript (or typescript) theoretically usable with other frameworks as well.

Copy link
Contributor

@kuzhelov kuzhelov Mar 21, 2019

Choose a reason for hiding this comment

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

@jurokapsiar, yes, exactly - I would expect that there would be this dependency expressed explicitly.

Please note that behaviors should be plain javascript (or typescript) theoretically usable with other frameworks as well.

While I do understand that we need this to be framework-agnostic, it seems a bit misleading that we are trying to generalize types based on React ones. The thing that I am worrying is that now what we are doing, essentially, is introducing this dependency you are talking about, with the only difference that it is implicit, compared to the approach I've suggested before.

Ideally, would expect some sort of common types library (TS lib.dom.d.ts?) for HTML attributes that we could rely on, without having React as a dependency

Copy link
Member Author

Choose a reason for hiding this comment

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

that we are trying to generalize types based on React ones.

But React types are correct in this case...

@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

Merging #1087 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1087      +/-   ##
==========================================
+ Coverage   81.76%   81.76%   +<.01%     
==========================================
  Files         701      701              
  Lines        8570     8573       +3     
  Branches     1171     1245      +74     
==========================================
+ Hits         7007     7010       +3     
  Misses       1548     1548              
  Partials       15       15
Impacted Files Coverage Δ
...ibility/Behaviors/Attachment/attachmentBehavior.ts 100% <ø> (ø) ⬆️
packages/react/src/components/Alert/Alert.tsx 100% <ø> (ø) ⬆️
...src/lib/accessibility/Behaviors/Tab/tabBehavior.ts 100% <ø> (ø) ⬆️
...b/accessibility/Behaviors/Menu/menuItemBehavior.ts 100% <ø> (ø) ⬆️
packages/react/src/lib/renderComponent.tsx 92% <ø> (ø) ⬆️
...ibility/Behaviors/Toolbar/toolbarButtonBehavior.ts 100% <ø> (ø) ⬆️
packages/react/src/lib/accessibility/types.ts 100% <ø> (ø) ⬆️
...eact/src/lib/accessibility/FocusZone/FocusZone.tsx 86.85% <100%> (ø) ⬆️
...sibility/Behaviors/Radio/radioGroupItemBehavior.ts 100% <100%> (ø) ⬆️
...lib/accessibility/Behaviors/Popup/popupBehavior.ts 89.28% <100%> (+0.39%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f9569e...62c0742. Read the comment docs.

@layershifter layershifter merged commit 84a4d22 into master Mar 21, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/acc-types branch March 21, 2019 16:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧰 fix Introduces fix for broken behavior. 🚀 ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants