feat: added the ability to close the hint using the keyboard#1812
feat: added the ability to close the hint using the keyboard#1812filippovskii09 wants to merge 9 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @filippovskii09! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1812 +/- ##
==========================================
+ Coverage 90.84% 90.87% +0.03%
==========================================
Files 345 348 +3
Lines 5800 5820 +20
Branches 1376 1342 -34
==========================================
+ Hits 5269 5289 +20
Misses 514 514
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @@ -0,0 +1,77 @@ | |||
| import React from 'react'; | |||
There was a problem hiding this comment.
Do we need this import?
| @@ -0,0 +1,77 @@ | |||
| import React from 'react'; | |||
| import { render } from '@testing-library/react'; | |||
There was a problem hiding this comment.
[question]: Is it possible to use function render from file setupTests https://github.com/openedx/frontend-app-learning/blob/master/src/setupTest.js#L222 in these tests?
There was a problem hiding this comment.
yes, fixed, i used render from setupTest
| @@ -1,3 +1,4 @@ | |||
| import React, { useState } from 'react'; | |||
There was a problem hiding this comment.
Do we need this React import?
| @@ -0,0 +1,127 @@ | |||
| import React from 'react'; | |||
There was a problem hiding this comment.
Do we need this import?
| @@ -0,0 +1,127 @@ | |||
| import React from 'react'; | |||
| import { render, screen, waitFor } from '@testing-library/react'; | |||
There was a problem hiding this comment.
[question]: Is it possible to use function render from file setupTests https://github.com/openedx/frontend-app-learning/blob/master/src/setupTest.js#L222 in these tests?
There was a problem hiding this comment.
yes, fixed, i used render from setupTest
| import { IntlProvider } from 'react-intl'; | ||
|
|
||
| import { fireEvent } from '@testing-library/dom'; | ||
| import GradeSummaryHeader from './GradeSummaryHeader'; |
There was a problem hiding this comment.
| import { IntlProvider } from 'react-intl'; | |
| import { fireEvent } from '@testing-library/dom'; | |
| import GradeSummaryHeader from './GradeSummaryHeader'; | |
| import { IntlProvider } from 'react-intl'; | |
| import { fireEvent } from '@testing-library/dom'; | |
| import GradeSummaryHeader from './GradeSummaryHeader'; |
| name: messages.gradeSummaryTooltipAlt.defaultMessage, | ||
| }); | ||
|
|
||
| fireEvent.click(iconButton); |
There was a problem hiding this comment.
Please replace with use userEvent here
https://testing-library.com/docs/user-event/intro/#difference-to-fireevent
| expect(screen.getByText(messages.gradeSummaryTooltipBody.defaultMessage)).toBeVisible(); | ||
| }); | ||
|
|
||
| fireEvent.click(iconButton); |
There was a problem hiding this comment.
Please replace with use userEvent here
https://testing-library.com/docs/user-event/intro/#difference-to-fireevent
| expect(screen.getByText(messages.gradeSummaryTooltipBody.defaultMessage)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| fireEvent.keyDown(iconButton, { key: 'Escape', code: 'Escape' }); |
There was a problem hiding this comment.
Please replace with use userEvent here
https://testing-library.com/docs/user-event/intro/#difference-to-fireevent
| useSelector: jest.fn(), | ||
| })); | ||
|
|
||
| describe('LiveTab', () => { |
There was a problem hiding this comment.
Can you explain why we are adding these tests to this PR?
It looks like we are proposing accessibility improvements in this PR, but we are writing tests for the functionality of the LiveTab component.
There was a problem hiding this comment.
These tests were cherry-picked along with the related changes from a previously closed PR.
The tests themselves are not directly related to the accessibility improvements.
I can separate them if needed, but for now, they ensure we don’t lose existing coverage.
There was a problem hiding this comment.
Yes, but these tests seem to test functionality that is not relevant to this PR. Will we have coverage issues if we remove them?
There was a problem hiding this comment.
deleted test and no problem occurred
| import GradeSummaryHeader from './GradeSummaryHeader'; | ||
| import { useModel } from '../../../../generic/model-store'; | ||
| import messages from '../messages'; | ||
| import { initializeMockApp, render } from '../../../../setupTest'; |
There was a problem hiding this comment.
[nit]: Please use @src alias
| onClick={() => { setShowTooltip(!showTooltip); }} | ||
| onBlur={() => { setShowTooltip(false); }} |
There was a problem hiding this comment.
| onClick={() => { setShowTooltip(!showTooltip); }} | |
| onBlur={() => { setShowTooltip(false); }} | |
| onClick={() => setShowTooltip(!showTooltip)} | |
| onBlur={() => setShowTooltip(false)} |
| @@ -0,0 +1,126 @@ | |||
| import { screen, waitFor } from '@testing-library/react'; | |||
There was a problem hiding this comment.
try to import from setupTest.js
|
Hi @filippovskii09, thank you for this contribution! Since it's a user-facing change, it will need product approval before it can be merged. Please choose your product contribution type and follow the corresponding instructions to get the product review process started. |
|
@itsjeyd thanks! I plan to create a product proposal and add all of our PRs related to accessibility improvements to it. For now, the PRs will be in draft and awaiting product review |
| import { IntlProvider } from 'react-intl'; | ||
|
|
||
| import { fireEvent } from '@testing-library/dom'; | ||
| import GradeSummaryHeader from './GradeSummaryHeader'; |
|
|
||
| const renderComponent = (props = {}) => { | ||
| render( | ||
| <IntlProvider locale="en" messages={messages}> |
There was a problem hiding this comment.
Do we need this extra IntlProvider?
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment failed 💥 |
|
Sandbox deployment successful 🚀 |
Hey @PKulkoRaccoonGang, just checking in to see if you had any updates on the proposal? |
|
Sandbox deployment successful 🚀 |
|
Sandbox deployment successful 🚀 |
Note
This PR has been added to the product proposal to improve accessibility.
Product proposal
Description
This PR provides a mechanism to close the tooltip using the keyboard. The escape key is recommended
Testing instructions
2025-10-23.16.57.37.mov