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 node-processing bug from dropdown temporary placeholder #1467

Conversation

wxwxwxwx9
Copy link
Contributor

@wxwxwxwx9 wxwxwxwx9 commented Feb 7, 2021

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • Others, please explain:

Overview of changes:
This issue was discovered in #1464. And this fix is needed for #1464 to continue.

Moved the dropdown temporary placeholder after the <dropdown> node itself. This is because having it before (as it is currently) would interfere with the processing of the nodes and it can be seen from the expected html file for test_site_algolia_expected that the nodes after dropdown are not processed properly. There are also a lot of duplicated <div class="temp-dropdown-placeholder"></div>.

Moving the placeholder after would allow the nodes after <dropdown> to be processed properly and this also means that we will need to update the algolia selectors (which will be done in a separate PR).

Anything you'd like to highlight / discuss:
If the method of resolution is appropriate.

Testing instructions:
npm run test

Proposed commit message: (wrap lines at 72 characters)
Fix node-processing bug from dropdown temporary placeholder.

Inserting the dropdown temporary placeholder before the dropdown itself
introduces some node processing bug, where nodes (e.g. panel) are not
processed properly after dropdown. Furthermore, it generates a lot of
duplicated dropdown temporary placeholder. This issue can be seen from
the test in test_site_algolia_expected.

Let's insert the dropdown temporary placeholder after the dropdown node
to circumvent this problem. Having it after the dropdown node will ensure
that the node processing is executed in a normal / fixed processing order.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No blatantly unrelated changes
  • Pinged someone for a review!

'question div[slot=hint]',
'question div[slot=answer]',
'tab:not(:first-child)',
'tab:nth-of-type(n+2)',
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'm assuming that we want to target all the instances of tab except for the first instance. As slot processing will introduce a new template node (which will become the first child instead of tab), this selector will not be correct.

I think what we should be selecting is the second instance of tab onwards, and this selector lets us achieve that.

Copy link
Contributor

Choose a reason for hiding this comment

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

let's move this (and above) to the other pr if necessary since we're just fixing the temp fouc styles here,
but both seem like separate pre-existing issues to me

For the second, it may be intended behaviour (e.g. in here https://markbind-master.netlify.app/userguide/usingcomponents#tabs - only the first (visible) one under <tabs> should be indexed)
Could look up the algolia pr, or git annotate this change to double check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright! I've made the changes :-)

'question div[slot=hint]',
'question div[slot=answer]',
'tab:not(:first-child)',
'tab:nth-of-type(n+2)',
'tab-group:not(:first-child)',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we use nth-of-type(n+2) here as well? I don't see problems here currently as we are not introducing new nodes (e.g. template) to become the first child, but I'm thinking nth-of-type(n+2) may be a more future-proof way to select the node.

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 here, seems like several of the selectors could use some refining overall
Let's move that to a different PR if you're up for it 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! will make a PR for that :-)

@wxwxwxwx9 wxwxwxwx9 changed the title Fix dropdown temporary placeholder node-processing Fix node-processing bug from dropdown temporary placeholder Feb 7, 2021
@wxwxwxwx9
Copy link
Contributor Author

Hi @ang-zeyu, can I get ur help to review this PR? :-)

Copy link
Contributor

@ang-zeyu ang-zeyu left a comment

Choose a reason for hiding this comment

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

Lgtm 👍

@ang-zeyu ang-zeyu added this to the v3.0 milestone Feb 7, 2021
@ang-zeyu ang-zeyu merged commit 0f87b15 into MarkBind:master Feb 7, 2021
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.

None yet

2 participants