@@ -30,6 +30,8 @@ export async function createGitIngestButton(): Promise<HTMLLIElement> {
30
30
// Create link with GitHub's button style
31
31
const link = document . createElement ( 'a' ) ;
32
32
link . className = 'btn-sm btn' ;
33
+ link . id = 'gitingest_btn' ;
34
+ link . setAttribute ( 'aria-describedby' , 'gitingest_tooltip' ) ;
33
35
34
36
// Get custom base URL and window preference from storage
35
37
const [ baseUrl , openInNewWindow ] = await Promise . all ( [
@@ -45,6 +47,10 @@ export async function createGitIngestButton(): Promise<HTMLLIElement> {
45
47
link . target = '_blank' ;
46
48
link . rel = 'noopener noreferrer' ;
47
49
}
50
+
51
+ const tooltipText = openInNewWindow
52
+ ? 'Turn this to a LLM-friendly prompt in a new tab'
53
+ : 'Turn this to a LLM-friendly prompt' ;
48
54
49
55
// Create spans for different screen sizes
50
56
const linkContent = `
@@ -54,8 +60,21 @@ export async function createGitIngestButton(): Promise<HTMLLIElement> {
54
60
` ;
55
61
link . innerHTML = linkContent ;
56
62
57
- // Add button to container
58
- li . appendChild ( link ) ;
63
+ // Create tooltip
64
+ const tooltip = document . createElement ( 'tool-tip' ) ;
65
+ tooltip . setAttribute ( 'for' , 'gitingest_btn' ) ;
66
+ tooltip . id = 'gitingest_tooltip' ;
67
+ tooltip . setAttribute ( 'popover' , 'manual' ) ;
68
+ tooltip . className = 'position-absolute sr-only' ;
69
+ tooltip . setAttribute ( 'role' , 'tooltip' ) ;
70
+ tooltip . textContent = tooltipText ;
71
+
72
+ // Add button and tooltip to container
73
+ const div = document . createElement ( 'div' ) ;
74
+ div . className = 'float-left' ;
75
+ div . appendChild ( link ) ;
76
+ div . appendChild ( tooltip ) ;
77
+ li . appendChild ( div ) ;
59
78
li . id = 'git-ingest-button' ;
60
79
61
80
return li ;
0 commit comments