-
Notifications
You must be signed in to change notification settings - Fork 142
Implement span.anchor in panel to replace id #1609
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
Implement span.anchor in panel to replace id #1609
Conversation
| import panelBase from './PanelBase'; | ||
|
|
||
| export default { | ||
| inheritAttrs: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm what's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vue passes non-prop attributes such as id to the root node of a component. In this case, we do not want the main panel container, div or span, to have the id as this interferes with anchor navigation.
The inheriAttrs: false is needed to prevent the root node of minimalPanel and nestedPanel from inheriting the id attribute.
https://v3.vuejs.org/guide/component-attrs.html#disabling-attribute-inheritance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying! Hmm how about changing the property name under assignPanelId (then using it as a prop)?
So there's no risk of side effects from disabling attribute inheritance entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup that would work as well. Will update it.
|
@ang-zeyu Updated the PR to pass in |
24c81ba to
35357dd
Compare
|
Lgtm 👍, just this portion that would have to be edited also since we aren't using (handles the auto scroll back to top) |
35357dd to
69ef766
Compare
|
@ang-zeyu Thanks for the catch. Have updated the PR :) |
| requestAnimationFrame(() => { | ||
| // To enable behaviour of auto window scrolling during panel collapse | ||
| if (this.$el.getBoundingClientRect().top < 0) { | ||
| const headerHeight = jQuery('header[fixed]').height() || 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a really minor nit for keeping everything under the panel implementation -- would this work?
const el = $refs.anchor || this.$el;
el .getBoundingClientRect......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm added ref="anchor" to the spans and doesn't seem to be working... The panel header still gets hidden under the navbar after collapsing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try adding display: inline-block to the scoped anchor class here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the sibling after span.anchor is interfering 🤣... let's leave it for now and revisit later
ang-zeyu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm 👍

What is the purpose of this pull request?
Overview of changes:
Follow-up to #1603 (comment). The support of
scroll-margin-topon ios is still limited thus require a different approach to handle anchor navigation for panels.Replace existing panel id with span.anchor (similar to how normal headers navigation works). This prevents the panels from getting blocked by the
fixed-headerbar as well as resolves #1601.Anything you'd like to highlight / discuss:
If there is a better workaround.
Apparently changing the width of

::beforedoes not fix #1601 as the entire panel block still occupies the vertical space of::beforeas well.The container which holds

::beforestill has the width of the panelTesting instructions:
page-navfixed-headerProposed commit message: (wrap lines at 72 characters)
Implement span.anchor in panel to replace id
The support of scroll-margin-top on ios is still limited hence
would require a different approach to handle anchor navigation
for panels while keeping elements before panels from getting
blocked.
Let's introduce span.anchor into panel, similar to how the headers
navigation works, to support anchor navigation as well as to prevent
previous elements from getting blocked.
Checklist: ☑️