-
Notifications
You must be signed in to change notification settings - Fork 91
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: add Gatsby theme New Relic global nav to Open Source site mobile views (#556) #608
Conversation
… styling context. Remove hiding of GlobalHeader on mobile/narrow views and remove the static position overrride to meet requirement that GlobalHeader behave as on other sites
…mobile GlobalHeader
Hm, a bit stumped by the Jest check failing. I pushed 7ff7b7f to update the snapshots, and |
Hey @tyreer thanks for getting to this! Once we merge newrelic/gatsby-theme-newrelic#78, I'd love to have you update this PR to use the latest version of the gatsby theme which should also address the mobile view. That |
Sounds like a plan @jerelmiller. Figured it might make sense to get the Gatsby fix in first, so thanks for hammering that out! I'll keep an eye on newrelic/gatsby-theme-newrelic#78 and update this PR once the dependency update is published for |
@jerelmiller Pulled in the the new Gatsby theme and the BUT, the Jest tests have been thrown off 😐 Getting the error below tracing back the
Might be related to
I tried some of the Have you encountered similar Jest errors before? |
Interesting. I think this error was obscured from us because there was some logic in versions < 1.7 that hid the overlay (which uses portals) in tests during render. The snapshot tests must not have been rendering the overlay until v1.7. Apparently I have not done much testing using Portals in |
@tyreer by chance are you seeing issues with a If so, I think I spotted something odd in the gatsby theme that might be causing this issue that I'd like to fix. |
I've opened a PR in the Gatsby theme repo that should address the jest issue you are seeing. Turns out we were including styles from |
Thanks for pointing out the changes on the Gatsby theme. Nice addition to the docs there. I'll consult once that PR goes through.
Yeah, seems sensible to me. I tried bringing in the new Gatsby theme into the
They just didn't have any effect. Same local Jest run errors with or without them.
None to speak of. I'm getting the same errors locally as in the run on this PR https://github.com/newrelic/opensource-website/pull/608/checks?check_run_id=994942678 I'll keep an eye on newrelic/gatsby-theme-newrelic#81 and circle back once that's through. Cheers! |
v1.7.1 has just been published. 🤞 that PR will address the testing issues you have been experiencing on this branch.
I added a new section on Testing to the Gatsby theme. I believe the I added a snapshot test for the global header in that PR to confirm that snapshot tests work correctly and they passed ok. Let me know if you have other issues here! I'd love to get this one out. Thanks for being patient and helping us uncover other issues that needed addressing! |
Hiya @jerelmiller 👋 I've pulled in v1.7.1 but haven't had any luck with the mocking. I set up a But I'm unclear how to apply that override in a given test. How would it be implemented in a Alternately, I again tried following the approaches for these 2 suggestions on the React repo issue, but to no effect:
I wonder if the override makes it down to Thanks for working with me on this! Hope it isn't turning into more than you bargained for. 😄 |
Another point I've noticed that I'm unsure how best to tackle: the As mentioned in the PR description, I've put In all, I'm seeing 17 rules with Any sense of a preferred approach to |
@danielgolden @djsauble This is a really good question from @tyreer. Do we have a preferred approach to z-indexes? I think we just kinda picked one out-of-the-hat in the theme, but clearly we've got issues with other elements overlapping. Could you provide some feedback here? |
I thought so since
You shouldn't need to do anything special in the spec file. The I might try the upgrade + some different ideas in a separate branch to get a better feel. Perhaps the test in the theme repo was a misnomer since its mocking Thanks so much for being patient! We'll get this one way or another 💪 |
@tyreer @jerelmiller Good catch on the z-index! The overlay should trump both the logo and global header, but you're right that we don't want an escalating z-index war. I suggest we cap the z-index scale to 1000, hopefully that's high enough to fix the overlay issue without resorting to a major refactor though we may want to do that eventually for consistency. |
@tyreer I opened a draft PR to try and isolate the tests to ensure there wasn't anything else at play. From that branch, it looks like I'm able to get the tests run successfully. Can you try out the changes in that PR (just re-implement them here) and see if that works? If not, I'd love it if you could paste the output from one of the failures to see if we spot anything else at play. |
.emotion-33 { | ||
>>>>>>> b61bcd7f034ce46a961d06edd8828a5c1905eab7 |
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.
I notice a lot of these snapshots have these conflict indicators in here. I'm wondering if this is part of the problem. After adding the react-dom
mock, could you run npm test -- -u
to re-update these and see if tests pass for you?
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.
Nailed it!
Not sure how those merge conflict came up. Seemed odd to have them in snapshots of all places. I had run the alias test:update
, but maybe the mock file wasn't properly in place at the time and I forgot to run another snapshot update after I'd put the mock in.
Clearly missed loads when trying to resolve in e2daec8, but that kinda pointed us in the right direction in the end.
Sorted now! 🎉 Thanks a lot for stepping through this with me.
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.
🎉 🎉 🎉 🎉 🎉
So glad that worked! Glad I could help!
Sounds sensible to me @djsauble So we'd say the This repo has 6 layers. Any preference between the two options below for a refactor? I think option B is cleaner, personally. Option A
Option B
|
@tyreer I'm a sucker for linear scales, Option B looks great. 🙂 |
I can get a quick PR to adjust the overlay z-index. In the mean time, I see no reason not to accept this PR. Thanks so much for working through this! |
This should address the issue seen in the open source site where the search overlay is not currently displayed on top of everything else. This fits with the [new z-index scale](newrelic/opensource-website#608 (comment)).
🎉 This PR is included in version 1.8.5 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Thanks for all the time and effort you put into this PR, @tyreer!! We really appreciate it :) |
You're welcome @danielgolden ! Glad we were able to sort out the curve balls and happy I could help out 😃 |
These changes should address: #556
The global nav should now mirror the experience on https://developer.newrelic.com/ as requested in the bug ticket.
I can see the global Gatsby theme nav was disabled on mobile views and set to be
static
rather thansticky
. I caught and resolved a couple complications from removing the mobiledisplay: none
rule, but it's worth some manual exploration to confirm there aren't regressions I didn't clock.Notes
My changes in 16f614f modify some styles that link back to changes in 637f7e0, which I'm not familiar with. Might be worth someone close to that work giving this MR's changes a glance
I added a
z-index
for theGlobalHeader
that hopefully matches the repo’s convention (10, 100, 1000, etc.) I went with the highest I could find, but in looking it up, I'm not 100% convinced that.iframe-container
class (where I grabbed thez-index: 1000000
value from) is being used. Still went with it to be better safe than sorry. Without thez-index
a number of the homepage elements will display at a higher layer than theGlobalHeader
.While working on this, I noticed and raised an issue that should be addressed on the Gatsby theme repo: GlobalHeader is cut off by overflow:hidden on narrow viewports gatsby-theme-newrelic#79