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

Breaking: Update and modernize, simplify configuration (fixes #41 #48) #49

Merged
merged 62 commits into from
Feb 27, 2024

Conversation

swashbuck
Copy link
Contributor

@swashbuck swashbuck commented Aug 30, 2023

Fix #41 #48

Fix

  • Convert to ES6 syntax
  • Convert templates to JSX
  • Add missing _iconClass help text to properties.schema
  • Adds default icon values to schemas so that they are pre-populated in the AAT
  • Update README.md and example.json
  • Integration with Tooltip API. Bumps required framework version to 5.30.2.

Breaking

  • Replaces _alignIconRight with _iconAlignment. Suggest using 'auto' for all buttons which adjusts for RTL vs. LTR. The Next button icon will also be adjusted accordingly when using 'auto' (see examples below)
  • Removes _sibling buttons
  • Removes _returnToPreviousLocation button

Dependencies

Tooltip issue fix: adaptlearning/adapt-contrib-core#464

Testing

Ideally, please include the following in your testing:

  • All five button types
  • With icons only, with text only, and with both icons and text
  • All icon alignment options
  • LTR vs. RTL with respect to the icon alignment

Icon alignment

The following demonstrates the options for _iconAlignment using LTR vs. RTL.

Left-to-right (LTR)

Note that the Next button icon should be right-aligned when using auto.
LTR

Right-to-left (RTL)

Note that the Next button icon should be left-aligned when using auto.
RTL

@swashbuck swashbuck self-assigned this Aug 30, 2023
@swashbuck swashbuck added the enhancement New feature or request label Aug 30, 2023
@swashbuck swashbuck changed the title Fix: Update and modernize code (fixes #41) Breaking: Update and modernize code (fixes #41) Aug 30, 2023
js/PageNavView.js Outdated Show resolved Hide resolved
@swashbuck swashbuck changed the title Breaking: Update and modernize code (fixes #41) Breaking: Update and modernize code (fixes #41 #48) Aug 31, 2023
js/PageNavModel.js Outdated Show resolved Hide resolved
js/PageNavModel.js Outdated Show resolved Hide resolved
js/PageNavView.js Outdated Show resolved Hide resolved
js/PageNavModel.js Outdated Show resolved Hide resolved
@kirsty-hames
Copy link
Contributor

Text and/or icon display is working as expected thanks @swashbuck. Testing all _iconAlignment options in both RTL/LTR.

I have discovered a tooltip display issue which seems to be specific to Safari. When selecting the _root or _up button, the tooltip continues to display. See screenshots below.

When selecting _root, you're navigated to the menu. Tooltip still displays.
root_1
Go back into the page. Tooltip still displays.
root_2
Select _next, you're navigated to the next page. Tooltip still displays.
root_3

I was able to replicate this on Safari Mac, iPad and iPhone. Android tablet worked as expected.

@swashbuck
Copy link
Contributor Author

Good catch, @kirsty-hames . I can reproduce the issue, too. It also seems that it's sometimes adding whitespace to the bottom of the page:

Both issues seem to resolve when you resize the browser window.

@oliverfoster Do you think this is an issue with the Tooltip API itself?

@oliverfoster
Copy link
Member

I don't know, it shouldn't, it's all absolutely / fixed position so shouldn't take up space in the document flow. Could you investigate please?

@oliverfoster
Copy link
Member

re tooltips not disappearing:

pageNav does this on button click:

router.navigateToElement(id);

a tooltip should call remove when any [data-tooltip-id] element emits a blur event:
https://github.com/adaptlearning/adapt-contrib-core/blob/6be73dead91e631ec5eeb2cacf34f0a33a06837a/js/views/TooltipItemView.js#L133
https://github.com/adaptlearning/adapt-contrib-core/blob/6be73dead91e631ec5eeb2cacf34f0a33a06837a/js/views/TooltipItemView.js#L48C40-L48C57

It may be a lifecycle/timing issue between the button click, mouseover to show the tooltip, and the navigate. Tooltips may be displaying the tooltip after it should listen for blur events?

@swashbuck
Copy link
Contributor Author

swashbuck commented Oct 24, 2023

@oliverfoster In 47c42b1, I force the Page Nav button to fire a blur event by focusing on the body. Previously, it wasn't firing onMouseOut() in TooltipItemView.js after clicking it. This seems to fix the problem, but do you think it has any ramifications for accessibility and screen reader focus?

Otherwise, @kirsty-hames , is this now working for you?

@kirsty-hames
Copy link
Contributor

kirsty-hames commented Oct 25, 2023

@oliverfoster In 47c42b1, I force the Page Nav button to fire a blur event by focusing on the body. Previously, it wasn't firing onMouseOut() in TooltipItemView.js after clicking it. This seems to fix the problem, but do you think it has any ramifications for accessibility and screen reader focus?

Otherwise, @kirsty-hames , is this now working for you?

Thanks for looking into this @swashbuck. I can confirm this is working as expected in Safari and I gave this a quick run through with voiceOver. Just FYI, I may have found a global issue with tooltip focus (not sure if it's expected functionality) which I'll query as an issue on Core - see issue for ref.

@oliverfoster
Copy link
Member

@oliverfoster In 47c42b1, I force the Page Nav button to fire a blur event by focusing on the body. Previously, it wasn't firing onMouseOut() in TooltipItemView.js after clicking it. This seems to fix the problem, but do you think it has any ramifications for accessibility and screen reader focus?

Otherwise, @kirsty-hames , is this now working for you?

I think it would be better if the tooltips hid themselves on navigating to a new page.

@swashbuck
Copy link
Contributor Author

I think it would be better if the tooltips hid themselves on navigating to a new page.

@oliverfoster Ok, I've created adaptlearning/adapt-contrib-core#463 , so I'll take a look there.

@swashbuck
Copy link
Contributor Author

@kirsty-hames @oliverfoster Will you review adaptlearning/adapt-contrib-core#464 ? I believe that will fix the tooltip issue.

Copy link
Contributor

@kirsty-hames kirsty-hames left a comment

Choose a reason for hiding this comment

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

I've retested this with Core PR 465 and can confirm adaptlearning/adapt-contrib-core#463 resolved.

@oliverfoster
Copy link
Member

Are we happy that this will break existing AATs if installed over the top?

@swashbuck
Copy link
Contributor Author

@danielghost @kineopete Just to clarify, was the decision to hold off on this PR until the migration scripts are ready? If so, I can add a "needs migration" label here.

@oliverfoster
Copy link
Member

Sure. Sounds good.

@swashbuck
Copy link
Contributor Author

I would like to make a case for merging this PR now rather than waiting for the migration scripts.

  1. The only breaking change that the migration scripts would address would be the icon alignment. The _returnToPreviousLocation and _sibling options have simply been removed, so there's nothing to migrate.
  2. I have set up the icon alignment with sensible defaults. For instance, the icon for the _previous button is positioned on the left whereas the icon for the _next button is on the right. Then, for RTL, it's the reverse.
  3. If there is a case where the icon has been positioned on the top or bottom, that would have been handled via custom theme work anyway. So, there wouldn't be a migration option for that.

Happy to discuss further in our next team call.

@swashbuck swashbuck linked an issue Feb 26, 2024 that may be closed by this pull request
@oliverfoster oliverfoster merged commit 2663645 into master Feb 27, 2024
@oliverfoster oliverfoster deleted the issue/41 branch February 27, 2024 11:50
Copy link

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should tooltips be using the Core tooltip API? Update and modernize code
4 participants