-
Notifications
You must be signed in to change notification settings - Fork 0
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
FP-990 & FP-1255: Update <IntroMessage>
to Use Dismissible <SectionMessage>
#616
FP-990 & FP-1255: Update <IntroMessage>
to Use Dismissible <SectionMessage>
#616
Conversation
@swillrich5 found and fixed this bug. I replicate the fix so I can test my FP-990 solution.
I couldn't figure out how to use `<Sectionmessage>` to achieve FP-990.
Codecov Report
@@ Coverage Diff @@
## main #616 +/- ##
==========================================
+ Coverage 67.51% 70.21% +2.70%
==========================================
Files 408 200 -208
Lines 12761 5529 -7232
Branches 2339 1567 -772
==========================================
- Hits 8615 3882 -4733
+ Misses 3861 1571 -2290
+ Partials 285 76 -209
Flags with carried forward coverage won't be shown. Click here to find out more.
|
(simple cause during migration to vite)
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.
Section Message looks too harsh against the Portal UI (source).
Update: I proposed new colors to Design. [Color changes were approved.]
I know I break no other styles because only Message...css used these.
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.
Notes for reviewers.
expect( | ||
getByRole('alert', { class: /introMessageGeneral/i }) | ||
).toBeInTheDocument(); | ||
expect(getByRole('status', { name: 'message' })).toBeInTheDocument(); |
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.
Explanation. Update test for <IntroMessage>
, which has different aria role than did <Alert>
. The aria role for any <(...)Message>
is status
.
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
import { SectionMessage } from '_common'; |
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.
Changes on this page are for FP-990.
expect(getByRole('alert')).not.toEqual(null); | ||
expect(getByRole('status')).not.toEqual(null); |
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.
Explanation. Same as for <ManageAccount>
test update.
*/ | ||
const Message = ({ | ||
ariaLabel, |
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.
Explanation. Changes about ARIA label (see ff2a61e) are related to fixing <ManageAccount>
test case.
.is-info .icon { | ||
.is-info .icon:not(.close-icon) { |
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.
Explanation. Fix same problem as in #615 (comment), but using my proposed solution.
@@ -54,7 +54,7 @@ function SectionMessages({ | |||
const introMessageContent = introMessageText || MESSAGES[introMessageName]; | |||
const introMessage = introMessageContent && ( | |||
/* FAQ: Alternate message name allows tracking custom message dismissal */ | |||
<IntroMessage messageName={introMessageName || introMessageText}> | |||
<IntroMessage messageName={introMessageName || introMessageText} canDismiss> |
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.
Directly for FP-1255.
* <Sample jsx> | ||
* // basic usage | ||
* <SectionMessage type="warning">Uh oh.</SectionMessage> | ||
* @see _common/Message | ||
*/ | ||
const SectionMessage = (props) => { |
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.
Changes below on this page are for FP-1255.
client/src/components/_common/SectionMessage/SectionMessage.jsx
Outdated
Show resolved
Hide resolved
const autoManageVisible = props.canDismiss && props.isVisible === undefined; | ||
const autoManageDismiss = props.canDismiss && props.onDismiss === undefined; |
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.
Explanation. If users want a dismissible message—i.e. they passed canDismiss
—but choose to not manage that logic themselves—via isVisible
and onDismiss
—then this component will manage that logic automatically.
P.S. Alternative ideas are welcome.
--global-color-info--normal: var(--global-color-primary--x-dark); | ||
--global-color-info--weak: var(--global-color-primary--x-light); | ||
--global-color-info--dark: var(--global-color-primary--x-dark); | ||
--global-color-info--normal: var(--global-color-primary--normal); | ||
--global-color-info--light: var(--global-color-primary--x-light); |
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.
Note. I slowly replace --weak
colors with "standardly-named" --(x-)light
and --(x-)dark
.
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.
LGTM, nice work!
@@ -170,6 +191,7 @@ Message.propTypes = { | |||
type: PropTypes.oneOf(TYPES).isRequired, | |||
}; | |||
Message.defaultProps = { | |||
ariaLabel: 'message', |
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.
👍
client/src/components/_common/SectionMessage/SectionMessage.jsx
Outdated
Show resolved
Hide resolved
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.
Works well! I'll try to merge this into my FP-1375 PR (has similar parts for SectionMessages
).
Left a few comments for style.
client/src/components/_common/SectionMessage/SectionMessage.jsx
Outdated
Show resolved
Hide resolved
if (autoManageDismiss) { | ||
messageProps.onDismiss = onDismiss; | ||
} |
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.
Doesn't line 30 set onDismiss
regardless?
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.
Yes, nice catch. Line 30 is cruft. This conditional setting of the variable is desired. I dropped line 30 (ce6795f) and re-tested successfully.
client/src/components/_common/SectionMessage/SectionMessage.jsx
Outdated
Show resolved
Hide resolved
Set props undefined, instead of removing and creating two unsued vars.
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.
LGTM!
<IntroMessage>
to Use Dismissible <SectionMessage>
To Do
Done
Overview:
Use
SectionMessage
, notAlert
, for page welcome messages.Related Jira tickets:
Summary of Changes:
<SectionMessage>
<SectionMessage>
not<Alert>
.Testing Steps:
FP-990
<SectionMessage>
(see UI Patterns) not<Alert>
.FP-1225
UI Photos:
Dismissal.mov
Questions:
What is the easy way to get messages to re-appear after dismissing them? They are no longer in browser storage, so I can't just delete their statuses like I could before.