Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aidmi
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
aidmi
Commits
cb3f60c6
Commit
cb3f60c6
authored
8 months ago
by
Mike Feranda
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3473962
by mferanda: Cannot use tab to navigate over to AI, describe my image!
parent
fb9be249
Branches
Branches containing commit
Tags
1.0.0-beta8
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/aidmi_ckeditor.js
+9
-6
9 additions, 6 deletions
js/aidmi_ckeditor.js
with
9 additions
and
6 deletions
js/aidmi_ckeditor.js
+
9
−
6
View file @
cb3f60c6
...
...
@@ -55,8 +55,15 @@ let aidmiEditedText;
const
callback
=
(
mutationsList
)
=>
{
mutationsList
.
forEach
((
mutation
)
=>
{
if
(
mutation
.
type
===
'
attributes
'
)
{
const
regex
=
/^ck-labeled-field-view/
;
// Find id starting with...
let
regex
=
/^ck-labeled-field-view/
;
if
(
typeof
mutation
.
target
!==
'
undefined
'
&&
regex
.
test
(
mutation
.
target
.
id
))
{
const
existingButton
=
document
.
querySelector
(
'
.aidmi-button
'
);
// Check if the button already exists.
// Find in old class value.
regex
=
/ck-input_focused/
;
if
(
regex
.
test
(
mutation
.
oldValue
))
{
existingButton
.
focus
();
}
altTextField
=
mutation
.
target
;
imgTag
=
aidmiActiveEditorInstance
.
data
.
stringify
(
aidmiActiveEditorInstance
.
model
.
getSelectedContent
(
aidmiActiveEditorInstance
.
model
.
document
.
selection
));
if
(
altTextField
)
{
...
...
@@ -96,7 +103,7 @@ let aidmiEditedText;
button
.
classList
.
add
(
'
link-icon
'
);
// Make sure the button is focusable via keyboard (part of tabbing order).
button
.
setAttribute
(
'
tabindex
'
,
'
0
'
);
button
.
setAttribute
(
'
tabindex
'
,
'
1
'
);
// Add ARIA attributes for accessibility
button
.
setAttribute
(
'
role
'
,
'
button
'
);
button
.
setAttribute
(
'
aria-label
'
,
'
AI, describe my image button
'
);
...
...
@@ -115,8 +122,6 @@ let aidmiEditedText;
openOffCanvasDialog
(
data
,
(
isConfirmed
)
=>
{
if
(
isConfirmed
)
{
// Check if the imgTag has an alt attribute.
console
.
log
(
isConfirmed
);
console
.
log
(
'
nope
'
);
updateImageAltInCKEditor
(
ckEditorInstance
,
imgUuid
,
aidmiEditedText
);
}
});
...
...
@@ -136,8 +141,6 @@ let aidmiEditedText;
// Set focus on the button explicitly to ensure it's reachable by keyboard.
button
.
focus
();
}
else
{
// Set focus on the existing button.
existingButton
.
focus
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment