-
Notifications
You must be signed in to change notification settings - Fork 79
Fix titlebar truncation with ellipsis #630
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
Open
rabanspiegel
wants to merge
9
commits into
main
Choose a base branch
from
emdash/truncate-top-bar-3xz
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+143
−2
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b3a213a
Refine titlebar context controls
rabanspiegel 20dda9c
Adjust titlebar context styling
rabanspiegel 4c3c9d4
Fix titlebar dropdown truncation
rabanspiegel 65003a4
Fix titlebar select truncation with ellipsis
rabanspiegel 69b13e5
Align titlebar and dropdown truncation width
rabanspiegel 3ceb7c5
Format titlebar components
rabanspiegel 162ff47
Add min-width to task selector for clickable empty state
rabanspiegel 1a286ac
Merge origin/main and resolve conflicts
arnestrickmann c19b51d
fix: constrain titlebar drag region to actual select elements
rabanspiegel 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| import React from 'react'; | ||
| import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select'; | ||
| import type { Project, Task } from '../../types/app'; | ||
|
|
||
| interface TitlebarContextProps { | ||
| projects: Project[]; | ||
| selectedProject: Project | null; | ||
| activeTask: Task | null; | ||
| onSelectProject: (project: Project) => void; | ||
| onSelectTask: (task: Task) => void; | ||
| } | ||
|
|
||
| const TitlebarContext: React.FC<TitlebarContextProps> = ({ | ||
| projects, | ||
| selectedProject, | ||
| activeTask, | ||
| onSelectProject, | ||
| onSelectTask, | ||
| }) => { | ||
| if (!selectedProject) { | ||
| return <div />; | ||
| } | ||
|
|
||
| const tasks = selectedProject?.tasks ?? []; | ||
| const projectValue = selectedProject.id; | ||
| const taskValue = activeTask?.id; | ||
| const projectLabel = selectedProject.name; | ||
| const taskLabel = activeTask?.name ?? ''; | ||
| const selectContentClassName = 'w-[min(280px,90vw)]'; | ||
|
|
||
| const handleProjectChange = (value: string) => { | ||
| const nextProject = projects.find((project) => project.id === value); | ||
| if (nextProject) { | ||
| onSelectProject(nextProject); | ||
| } | ||
| }; | ||
|
|
||
| const handleTaskChange = (value: string) => { | ||
| const nextTask = tasks.find((task) => task.id === value); | ||
| if (nextTask) { | ||
| onSelectTask(nextTask); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="grid w-full grid-cols-[1fr_auto_1fr] items-center"> | ||
| <div className="flex items-center justify-end"> | ||
| <Select value={projectValue} onValueChange={handleProjectChange}> | ||
| <SelectTrigger | ||
| className="pointer-events-auto h-7 w-auto justify-start gap-1 border-none bg-transparent px-1 py-0.5 text-[13px] font-medium leading-none text-muted-foreground shadow-none [-webkit-app-region:no-drag] hover:bg-background/70 hover:text-foreground data-[state=open]:bg-background/80 data-[state=open]:text-foreground [&>span]:block [&>span]:max-w-[218px] [&>span]:truncate [&>svg]:hidden" | ||
| aria-label="Select project" | ||
| title={projectLabel} | ||
| > | ||
| <SelectValue placeholder="Project" /> | ||
| </SelectTrigger> | ||
| <SelectContent side="bottom" align="start" className={selectContentClassName}> | ||
| {projects.length > 0 ? ( | ||
| projects.map((project) => ( | ||
| <SelectItem | ||
| key={project.id} | ||
| value={project.id} | ||
| className="min-w-0 [&>span:last-child]:block [&>span:last-child]:min-w-0 [&>span:last-child]:truncate" | ||
| > | ||
| {project.name} | ||
| </SelectItem> | ||
| )) | ||
| ) : ( | ||
| <SelectItem value="__empty_projects__" disabled> | ||
| No projects yet | ||
| </SelectItem> | ||
| )} | ||
| </SelectContent> | ||
| </Select> | ||
| </div> | ||
| <span className="px-2 text-center text-[11px] text-muted-foreground/60">/</span> | ||
| <div className="flex items-center justify-start"> | ||
| <Select value={taskValue} onValueChange={handleTaskChange} disabled={!selectedProject}> | ||
| <SelectTrigger | ||
| className="pointer-events-auto h-7 w-auto min-w-[60px] justify-start gap-1 border-none bg-transparent px-1 py-0.5 text-[13px] font-medium leading-none text-muted-foreground shadow-none [-webkit-app-region:no-drag] hover:bg-background/70 hover:text-foreground data-[state=open]:bg-background/80 data-[placeholder]:text-muted-foreground/70 data-[state=open]:text-foreground [&>span]:block [&>span]:max-w-[218px] [&>span]:truncate [&>svg]:hidden" | ||
| aria-label="Select task" | ||
| title={taskLabel} | ||
| > | ||
| <SelectValue placeholder="" /> | ||
| </SelectTrigger> | ||
| <SelectContent side="bottom" align="start" className={selectContentClassName}> | ||
| {tasks.length > 0 ? ( | ||
| tasks.map((task) => ( | ||
| <SelectItem | ||
| key={task.id} | ||
| value={task.id} | ||
| className="min-w-0 [&>span:last-child]:block [&>span:last-child]:min-w-0 [&>span:last-child]:truncate" | ||
| > | ||
| {task.name} | ||
| </SelectItem> | ||
| )) | ||
| ) : ( | ||
| <SelectItem value="__empty_tasks__" disabled> | ||
| No tasks yet | ||
| </SelectItem> | ||
| )} | ||
| </SelectContent> | ||
| </Select> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default TitlebarContext; | ||
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.
Missing pointer-events-none blocks titlebar window dragging
Medium Severity
The grid container and its child elements in
TitlebarContextlackpointer-events-none, causing them to capture click/drag events. Since CSSpointer-eventsis not inherited, these elements default toautodespite the parent wrapper havingpointer-events-none. This blocks window dragging in the titlebar area around and between the dropdown triggers, as reported in the PR discussion.Additional Locations (2)
src/renderer/components/titlebar/TitlebarContext.tsx#L46-L47src/renderer/components/titlebar/TitlebarContext.tsx#L74-L76