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

fix(Alert): add isFromKeyboard to state #1238

Merged
merged 2 commits into from
Apr 22, 2019
Merged

fix(Alert): add isFromKeyboard to state #1238

merged 2 commits into from
Apr 22, 2019

Conversation

layershifter
Copy link
Member

Fixes #1230.

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #1238 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1238      +/-   ##
==========================================
+ Coverage   71.57%   71.58%   +0.01%     
==========================================
  Files         730      730              
  Lines        5579     5582       +3     
  Branches     1634     1612      -22     
==========================================
+ Hits         3993     3996       +3     
  Misses       1581     1581              
  Partials        5        5
Impacted Files Coverage Δ
packages/react/src/components/Alert/Alert.tsx 100% <100%> (ø) ⬆️

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 ac07054...ef6d55f. Read the comment docs.

@@ -108,6 +130,7 @@ class Alert extends UIComponent<ReactProps<AlertProps>> {
return (
<ElementType
className={classes.root}
onFocus={this.handleFocus}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be added on the action, instead of the root element?

Copy link
Contributor

Choose a reason for hiding this comment

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

The Alert itself as far as I understand is not focusable

Copy link
Member Author

Choose a reason for hiding this comment

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

Current points:

  • as I see the whole Alert is not focusable by spec, so currently only action slot can be focused
  • focus event will be propogated from the action slot

If we will have issues with this in future, i.e. the whole Alert can be focused we can separate values to isFromKeyboard & isAlertFromKeyboard.

Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense, I understand that it will be propagated, but my point was more in a sense that, if the content of the alert has focusable event, it would in the same way behave. But we can anyway use the ':focus' selector together with the isFromKeyboard state value, so it should be ok.

Copy link
Collaborator

@codepretty codepretty left a comment

Choose a reason for hiding this comment

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

Yay! Thanks so much for fixing this! :)

@layershifter layershifter merged commit c5580e0 into master Apr 22, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/alert-is branch April 22, 2019 09:08
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.

Unable to style action button in Alert component
3 participants