-
Notifications
You must be signed in to change notification settings - Fork 689
Add sticky header to PR/Issue views #8285
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
Merged
+153
−2
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b28ad03
Initial plan
Copilot eadb467
Initial plan for sticky PR/Issue headers
Copilot f3da833
Add sticky header functionality with compact mode
Copilot 79ab7d6
Add high contrast mode and mobile responsiveness support
Copilot e52df1b
Add test for sticky header functionality
Copilot a88fb0b
Address code review: add constant and use requestAnimationFrame
Copilot e9e5ee1
Fix flickering at threshold with hysteresis
Copilot 623cbe2
Fix useEffect dependency issue with ref
Copilot cb46ded
Fix flickering with IntersectionObserver and pure CSS approach
Copilot 515a52c
Fix subtitle visibility and remove side borders/shadows
Copilot 53ff457
Fix subtitle visibility by adding flex: 1 to .details
Copilot 3375693
Fix IntersectionObserver to prevent stuck state on page load
Copilot afd4627
Fix sentinel observer to use threshold 0 without negative rootMargin
Copilot 863c9f4
Explicitly remove stuck class on mount and use threshold 1
Copilot 030cf1c
Replace IntersectionObserver with scroll-based position detection
Copilot 99f5a0c
Add requestAnimationFrame throttling and extract threshold constant
Copilot 8c2d4bb
reduce diff
alexr00 0d5f9a8
Hide edit title button when in sticky mode
Copilot 1ce8868
Merge branch 'main' into copilot/add-sticky-header-functionality
alexr00 86aa087
Use ID instead of title attribute for edit button selector
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import { default as assert } from 'assert'; | ||
| import * as React from 'react'; | ||
| import { cleanup, render } from 'react-testing-library'; | ||
| import { createSandbox, SinonSandbox } from 'sinon'; | ||
|
|
||
| import { PRContext, default as PullRequestContext } from '../../common/context'; | ||
| import { Overview } from '../overview'; | ||
| import { PullRequestBuilder } from './builder/pullRequest'; | ||
|
|
||
| describe('Overview', function () { | ||
| let sinon: SinonSandbox; | ||
|
|
||
| beforeEach(function () { | ||
| sinon = createSandbox(); | ||
| }); | ||
|
|
||
| afterEach(function () { | ||
| cleanup(); | ||
| sinon.restore(); | ||
| }); | ||
|
|
||
| it('renders the PR header with title', function () { | ||
| const pr = new PullRequestBuilder().build(); | ||
| const context = new PRContext(pr); | ||
|
|
||
| const out = render( | ||
| <PullRequestContext.Provider value={context}> | ||
| <Overview {...pr} /> | ||
| </PullRequestContext.Provider>, | ||
| ); | ||
|
|
||
| assert(out.container.querySelector('.title')); | ||
| assert(out.container.querySelector('.overview-title')); | ||
| }); | ||
|
|
||
| it('applies sticky class when scrolled', function () { | ||
| const pr = new PullRequestBuilder().build(); | ||
| const context = new PRContext(pr); | ||
|
|
||
| const out = render( | ||
| <PullRequestContext.Provider value={context}> | ||
| <Overview {...pr} /> | ||
| </PullRequestContext.Provider>, | ||
| ); | ||
|
|
||
| const titleElement = out.container.querySelector('.title'); | ||
| assert(titleElement); | ||
|
|
||
| // Initial state should not have sticky class | ||
| assert(!titleElement.classList.contains('sticky')); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do these strings (such as
Renamehere) get localized?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.
@alexr00
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.
No, there isn't a good story for localizing strings in webviews.