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

[GSoC] Quick navigation UI #396

Merged
merged 72 commits into from
Oct 31, 2022
Merged

[GSoC] Quick navigation UI #396

merged 72 commits into from
Oct 31, 2022

Conversation

sofiaromorales
Copy link
Contributor

@sofiaromorales sofiaromorales commented Jul 20, 2022

Bug/issue #, if applicable: NA

Summary

UI for Quick Navigation feature with keyboard navigation support

Dependencies

NA

Testing

Steps:

  1. Set the quickNavigation.enable flag to true inside theme-settings.json in the swift project theming settings (https://www.swift.org/documentation/docc/customizing-the-appearance-of-your-documentation-pages)
  2. Preview the documentation
  3. Open the quick navigation modal component by clicking on the button inside the filter input, / key or ⌘ + shift + o
  4. Type something inside the input bar to trigger the fuzzy search
  5. Assert that the symbols listed correspond to your input
  6. Use arrow keys to move through the results list
  7. Press Enter to access the symbol

Demo: https://sofiaromorales.github.io/SwiftDocC/documentation/swiftdocc

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

…tion

* Introduced a new component "QuickNavigationModal" that serves as UI for the new searching functionality.
* New regex pattern to match symbol titles by fuzzy and string match.
* Data store to control the Quick navigation modal from anywhere on the app without having to pass the data through multiple child compoents.

This change is under the quickNavigation feature flag.
* Refactor of match highlighter for Safari support using `QuickNavigationHighlighter` component
* Code quality improvements suggested on pr review
* Quick navigation modal with redesigned UI
* Keyboard navigation support
* `QuickNavigationModal` unit tests
* `QuickNavigationHighlighter` unit tests
* Styling refactor
* Minor UI fixes
@sofiaromorales sofiaromorales marked this pull request as ready for review July 28, 2022 06:01
@sofiaromorales
Copy link
Contributor Author

@marinaaisa ready for review :)

Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

Thanks, Sofía!
I started reviewing your PR, I'll continue tomorrow. I leave you some comments in the meantime.

src/components/Filter/FilterInput.vue Outdated Show resolved Hide resolved
src/components/Filter/FilterInput.vue Outdated Show resolved Hide resolved
src/components/Filter/FilterInput.vue Outdated Show resolved Hide resolved
src/components/Filter/FilterInput.vue Outdated Show resolved Hide resolved
src/components/Navigator/NavigatorCard.vue Outdated Show resolved Hide resolved
* Implemented tab navigation on matches list
* Changes to sorting logic to create more predictable results
* Made matching algorithm case insensitive
* Code cleanup
Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

Hi Sofía, thanks a lot for this huge PR! It's great work 🙌 I added some comments.

My main concerns is to see how we can do FilterInput more generic without adding specific logic to it. I left comments about it. Also, there is an AX issue with the keyboard tabbing backwards, I left another comment.

Congratulations on the tests, I'll see if we can add more and let you know. But your current progress on testing is very very good :)

src/components/Navigator/QuickNavigationModal.vue Outdated Show resolved Hide resolved
src/components/Filter/FilterInput.vue Outdated Show resolved Hide resolved
src/components/Filter/FilterInput.vue Outdated Show resolved Hide resolved
src/components/Filter/FilterInput.vue Outdated Show resolved Hide resolved
src/components/Navigator/QuickNavigationModal.vue Outdated Show resolved Hide resolved
src/components/Navigator/QuickNavigationModal.vue Outdated Show resolved Hide resolved
src/views/DocumentationTopic.vue Outdated Show resolved Hide resolved
* Freezing the index added into the store
* Input select with `cmd+A`
* Padding reduced and modal size increased
* Wrap around while scrolling up (closes #412)
* Modal resize on narrower viewports (closes #411)
* Removal of space character from the search
* Parent symbols transformed to original case
* Debounce time reduced
* `QuickNavigationBar` component
* `QuickNavigationBar` test file
@marinaaisa
Copy link
Member

I still see some regressions on the FilterInput

We should delete the padding on the clear-rounded-icon because it adds an extra 5px into the view.
Also the clear-rounded-icon elements looks visually much bigger than the filter__filter-button element so I would reduce its width to 12px.

Currently:
Screenshot 2022-09-27 at 17 55 28

Proposed changes:
Screenshot 2022-09-27 at 17 55 21

Also there is an extra left spacing on the quick-navigation__magnifier-icon-container that we may want to remove too.
Screenshot 2022-09-27 at 17 58 31

… on the value of `enableNavigator` to prevent trying to fetch data when the archive does not come with an index. Also, the logic to open `QuickNavigationModal ` depends on `enableNavigator`.
…into a utility file to clean up `NavigatorDataProvider`
src/components/Navigator/QuickNavigationModal.vue Outdated Show resolved Hide resolved
src/components/Navigator/QuickNavigationModal.vue Outdated Show resolved Hide resolved
src/views/DocumentationTopic.vue Outdated Show resolved Hide resolved
Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

Hey @sofiaromorales , I left couple of more comments.
I'll continue reviewing next week, hopefully we get to merge it soon, sorry for the delay. It's taking a long time but the progress and feature is big and amazing! Thanks again! :)

src/components/Navigator/QuickNavigationModal.vue Outdated Show resolved Hide resolved
src/components/Navigator/QuickNavigationModal.vue Outdated Show resolved Hide resolved
color: var(--color-figure-blue);
}
}
&__match-list {
overflow: scroll;
Copy link
Member

Choose a reason for hiding this comment

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

In Chrome, with an macOS system config of "Show scroll bar... Automatically"

This overflow scroll is creating a jumping effect and also an extra padding in the bottom when there is no results.

overflow-jump.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this, Marina. I fixed the padding overflow by setting the height to 0, but the layout shift is more tricky to fix, scrollbars, when set to show always, reposition the web content causing that jumping effect, overflow-y: overlay seems to fix it but is not widely supported by all browsers.

https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#browser_compatibility

You can check the implementation here 76dfe47

tests/unit/utils/indexData.spec.js Outdated Show resolved Hide resolved
@marinaaisa
Copy link
Member

Just a quick UI detail:

Whenever we have the focus on the Quick Navigation's filter, we may want to delete the border line on top of the match list. To achieve this you can add this line of CSS

.quick-navigation__filter.focus + .quick-navigation__match-list {
  border-top: 0;
}

@sofiaromorales
Copy link
Contributor Author

Thanks a lot for the review and patience @marinaaisa! Do you think it's safe to merge this already? I want to give people the opportunity to test quick navigation in their documentation, this way I can receive feedback and discover new bugs if any, and since it's under a feature flag, it will not affect the current functionality of the project

@marinaaisa marinaaisa self-requested a review October 31, 2022 17:48
@marinaaisa
Copy link
Member

@swift-ci test

Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

Congratulations on your hard work, Sofia, it's ready to be merged :)

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

Successfully merging this pull request may close these issues.

5 participants