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

Fixes function searching and jumping #389

Merged
merged 7 commits into from
Aug 21, 2024
Merged

Conversation

Spoffy
Copy link
Contributor

@Spoffy Spoffy commented Aug 20, 2024

This PR:

  • Reworks how function names are rendered on the functions page, meaning we don't need a hidden header element.
  • Adds attr_list as an extension (I think it should always have been there?)
  • Adds styling to make the (now visible) header elements match what was there before.
  • Fixes sections not expanding when jumped to via permalink or searching

Copy link

netlify bot commented Aug 20, 2024

Deploy Preview for grist-help-preview ready!

Name Link
🔨 Latest commit 61f04e2
🔍 Latest deploy log https://app.netlify.com/sites/grist-help-preview/deploys/66c603cc3567160007fe39ec
😎 Deploy Preview https://deploy-preview-389--grist-help-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Spoffy Spoffy marked this pull request as draft August 20, 2024 22:20
@dsagal
Copy link
Member

dsagal commented Aug 21, 2024

Thank you @Spoffy ! There is another piece of behavior that seems to need fixing: when clicking on a link to go to a function, we used to have a bit of JS that expands that function (since normally all are collapsed). It is in expandSelected() in help/en/docs/js/grist.js.

@Spoffy Spoffy marked this pull request as ready for review August 21, 2024 14:39
@Spoffy
Copy link
Contributor Author

Spoffy commented Aug 21, 2024

Thank you @Spoffy ! There is another piece of behavior that seems to need fixing: when clicking on a link to go to a function, we used to have a bit of JS that expands that function (since normally all are collapsed). It is in expandSelected() in help/en/docs/js/grist.js.

Thanks for pointing me at the right file - this should be all sorted now too!

@Spoffy Spoffy changed the title Fixes function searching Fixes function searching and jumping Aug 21, 2024
Copy link
Member

@dsagal dsagal left a comment

Choose a reason for hiding this comment

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

Works great, thank you! A couple small nitpicks / comment requests.

display: none;
}

/* The <code> block that serves as a function header annoyingly gets auto-wrapped in a <p> */
Copy link
Member

Choose a reason for hiding this comment

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

Is this comment out-of-date / no-longer-helpful now? The comment before the previous change also seems in need of an update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated them to better reflect their uses!

if (elem && elem.tagName === 'DETAILS') {
for (var el of document.querySelectorAll('details')) {
el.open = (el === elem);
var elemToTest = elem;
Copy link
Member

Choose a reason for hiding this comment

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

Would this be enough to replace the loop: elemToExpand = elem.closest('DETAILS')?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha, should be! Didn't know that function existed. :)

if (elem && elem.tagName === 'DETAILS') {
for (var el of document.querySelectorAll('details')) {
el.open = (el === elem);
var elemToTest = elem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Stylistically, there's no need to use var instead of modern let/const, is there? I know it's already there, but we don't need to keep using var for new code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was on the fence on this one myself, and figured I'd stick with the current approach for now.

In terms of compatibility - let/const are at 97%, so doubt there's any issues using them really.

@Spoffy Spoffy requested a review from dsagal August 21, 2024 15:14
Copy link
Member

@dsagal dsagal left a comment

Choose a reason for hiding this comment

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

Thank you!

@dsagal dsagal merged commit f58dbfa into master Aug 21, 2024
5 checks passed
@dsagal dsagal deleted the spoffy/fix-function-searching branch August 21, 2024 16:28
dsagal added a commit that referenced this pull request Nov 14, 2024
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.

3 participants