Skip to content
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

fix(#7524): Open in New Tab action from a sub-object in a layout #7542

Merged
merged 36 commits into from
Mar 11, 2024

Conversation

ozyx
Copy link
Member

@ozyx ozyx commented Mar 3, 2024

Closes #7524
Closes #6982

Describe your changes:

  • Fixes the "Open in New Tab" action for sub-objects
    • Removes logic that was meant for "data pivoting" feature to be able to pass time bound info to the main Open MCT app. Since "data pivoting" was moved to core Open MCT, this is no longer needed and was just causing crashes.
  • Greatly improves a11y of Menus and SuperMenus
  • Add .visibility-hidden global utility CSS class for providing accessible descriptions for screen-readers without affecting the view
  • Adds test for "Open in New Tab" from a display layout sub-object
  • Adds test data generation for display layout w/ sub-plot

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this a notable change that will require a special callout in the release notes Notable Change ? For example, will this break compatibility with existing APIs or projects which source these plugins?

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Is this a breaking change to be called out in the release notes?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

@ozyx ozyx added the type:bug label Mar 3, 2024
@ozyx ozyx added this to the Target:4.0.0 milestone Mar 3, 2024
Copy link

codecov bot commented Mar 3, 2024

Codecov Report

Attention: Patch coverage is 46.66667% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 55.38%. Comparing base (0eadc7a) to head (bfb2b66).

❗ Current head bfb2b66 differs from pull request most recent head e0645c4. Consider uploading reports for the commit e0645c4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7542      +/-   ##
==========================================
+ Coverage   53.96%   55.38%   +1.41%     
==========================================
  Files         672      672              
  Lines       27003    26996       -7     
  Branches     2624     2626       +2     
==========================================
+ Hits        14572    14951     +379     
+ Misses      11712    11326     -386     
  Partials      719      719              
Flag Coverage Δ
e2e-full 23.70% <50.00%> (-0.04%) ⬇️
e2e-stable 59.76% <100.00%> (+6.69%) ⬆️
unit 48.52% <46.66%> (+0.07%) ⬆️
Files Coverage Δ
...tion/components/ExampleDataVisualizationSource.vue 5.26% <ø> (+5.26%) ⬆️
src/api/menu/components/MenuComponent.vue 50.00% <ø> (ø)
src/api/menu/components/SuperMenu.vue 83.33% <ø> (+16.66%) ⬆️
src/plugins/clock/components/ClockIndicator.vue 75.00% <100.00%> (ø)
...gins/inspectorDataVisualization/TelemetryFrame.vue 0.00% <ø> (ø)
...c/plugins/openInNewTabAction/openInNewTabAction.js 100.00% <100.00%> (ø)
...Conductor/independent/IndependentTimeConductor.vue 0.00% <ø> (ø)
src/tools/url.js 100.00% <100.00%> (ø)
src/ui/components/ObjectFrame.vue 4.08% <ø> (-0.09%) ⬇️
src/ui/layout/CreateButton.vue 11.53% <100.00%> (ø)
... and 9 more

... and 67 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

@@ -19,7 +19,7 @@
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<!DOCTYPE html>
<!doctype html>
Copy link
Collaborator

Choose a reason for hiding this comment

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

lint?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep

@@ -65,15 +65,5 @@ describe('the url tool', function () {
const constructedURL = objectPathToUrl(openmct, mockObjectPath);
expect(constructedURL).toContain('#/browse/mock-parent-folder/mock-folder');
});
it('can take params to set a custom url', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we have precise coverage for this

Copy link
Member Author

Choose a reason for hiding this comment

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

The code this tested was removed

Copy link
Member Author

Choose a reason for hiding this comment

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

JK. it's back now

Copy link
Collaborator

@unlikelyzero unlikelyzero left a comment

Choose a reason for hiding this comment

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

Looks good so far. Let's take the time to understand what this means (from freecodecamp)

Know When to Use aria-describedby
Sometimes, we need to give more information to an element. For example, we might want to tell the user that the button they will press will open a new tab.

This information is important because the user needs to know where they are when navigating websites.

For these types of scenarios, we can use aria-describedby to give additional information.

Example:

⛔ BAD

<button aria-label="Close" aria-label="Opens in a new tab">	
Show related		
</button>

✅ GOOD

<button aria-label="Close" aria-describedby="description">
Show related		
</button>		
<div id="description">Opens in a new tab</div>

In the first example above, what engineers expect the screen reader to announce is: “button, Show related, opens in a new tab”.

But the screen reader does not do that. Instead, it says,“button, opens in a new tab”. The screen reader does not read the content inside, because aria-label always overrides the text content of the HTML5 element it has been applied to.

The second code snipped shows the correct way to use aria-describedby. The screen reader will read, “button, Show related, opens in a new tab”.

That information tells the user that the button is to show related content and if they press that button, it will navigate them to another tab.

Takeaway: Use aria-describedby to add additional information to elements.

@ozyx ozyx marked this pull request as ready for review March 4, 2024 01:47
await expect(page.locator('.itc-popout')).toBeInViewport();

await setTimeBounds(page, startDate, endDate);
await setTimeBounds(page, start, end);
Copy link
Collaborator

Choose a reason for hiding this comment

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

setTimeBoundsOfITC ?

Copy link
Member Author

Choose a reason for hiding this comment

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

it seems like it was designed to work for any time conductor? idk, I think all of these methods need an overhaul. not in this PR though.

@@ -174,6 +174,6 @@ test.describe('AppActions', () => {
type: 'Folder'
});
await openObjectTreeContextMenu(page, folder.url);
await expect(page.getByLabel('Menu')).toBeVisible();
await expect(page.getByLabel(`${folder.name} Context Menu`)).toBeVisible();
Copy link
Collaborator

Choose a reason for hiding this comment

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

woah

await newPage.waitForLoadState('domcontentloaded');

// Verify that the global time conductor bounds in the new page match the updated global bounds
expect(
Copy link
Collaborator

Choose a reason for hiding this comment

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

ok this makes sense

:class="action.cssClass"
:title="action.description"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we may want to keep titles, just not use them for tests

Copy link
Member Author

Choose a reason for hiding this comment

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

Generally this is true, but in this case the title was basically pointless. The same contents are displayed on the right and read aloud by the screen reader. The title in this particular case served no purpose

Copy link
Collaborator

@unlikelyzero unlikelyzero left a comment

Choose a reason for hiding this comment

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

Just two comments

@ozyx ozyx requested a review from davetsay March 4, 2024 17:21
@ozyx ozyx marked this pull request as draft March 4, 2024 21:16
@ozyx
Copy link
Member Author

ozyx commented Mar 4, 2024

Have a few more changes after talking to @davetsay . Moving back to draft for now

@ozyx ozyx marked this pull request as ready for review March 5, 2024 02:38
@davetsay
Copy link
Contributor

davetsay commented Mar 6, 2024

Looking good so far, @ozyx . @unlikelyzero must be losing his mind over this one.

@@ -260,7 +260,7 @@ export default {
event.preventDefault();
this.preview(this.objectPath);
} else {
const resultUrl = identifierToString(this.openmct, this.objectPath);
const resultUrl = objectPathToUrl(this.openmct, this.objectPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice catch

Copy link
Member Author

Choose a reason for hiding this comment

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

right! we had a default export in addition to named exports in that file... scary

@@ -121,7 +121,8 @@ export default {
};
const newTabAction = this.openmct.actions.getAction('newTab');
// No view context needed, so pass undefined.
// The urlParams arg will override the global time bounds with the dataviz plot bounds.
// The urlParams arg will override the global time bounds with the data visualization
Copy link
Contributor

Choose a reason for hiding this comment

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

haha

Copy link
Contributor

@davetsay davetsay left a comment

Choose a reason for hiding this comment

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

one question / potential change. and I'm going to smoke test this before merging.

src/plugins/inspectorDataVisualization/TelemetryFrame.vue Outdated Show resolved Hide resolved
@akhenry akhenry requested a review from davetsay March 11, 2024 21:24
Copy link
Contributor

@davetsay davetsay left a comment

Choose a reason for hiding this comment

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

Great work.

@davetsay davetsay added the pr:e2e:couchdb npm run test:e2e:couchdb label Mar 11, 2024
@davetsay davetsay enabled auto-merge (squash) March 11, 2024 23:14
@unlikelyzero unlikelyzero merged commit 8c2558b into master Mar 11, 2024
4 of 10 checks passed
@unlikelyzero unlikelyzero deleted the mct7524 branch March 11, 2024 23:39
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants