Skip to content

Commit 90699c4

Browse files
Samiya CaurDevtools-frontend LUCI CQ
authored andcommitted
[Ai Assistance] Fix overlap of text and screenshot button
Also, the screenshot button should not be visible when chat blocked by cross origin Bug: 397376612 Change-Id: Ia5be54a32d478e4c9523c76e99dbb5eea8df27da Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6298369 Commit-Queue: Samiya Caur <[email protected]> Auto-Submit: Samiya Caur <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]>
1 parent 2c465b6 commit 90699c4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

front_end/panels/ai_assistance/components/ChatView.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,14 +1203,16 @@ function renderChatInputButtons(
12031203

12041204
function renderTakeScreenshotButton({
12051205
multimodalInputEnabled,
1206+
blockedByCrossOrigin,
12061207
isTextInputDisabled,
12071208
onTakeScreenshot,
12081209
}: {
12091210
isTextInputDisabled: boolean,
1211+
blockedByCrossOrigin: boolean,
12101212
multimodalInputEnabled?: boolean,
12111213
onTakeScreenshot?: () => void,
12121214
}): Lit.LitTemplate {
1213-
if (!multimodalInputEnabled) {
1215+
if (!multimodalInputEnabled || blockedByCrossOrigin) {
12141216
return Lit.nothing;
12151217
}
12161218
return html`<devtools-button
@@ -1308,6 +1310,7 @@ function renderChatInput({
13081310
const chatInputCls = Lit.Directives.classMap({
13091311
'chat-input': true,
13101312
'two-big-buttons': blockedByCrossOrigin,
1313+
'screenshot-button': Boolean(multimodalInputEnabled) && !blockedByCrossOrigin,
13111314
});
13121315

13131316
const chatInputContainerCls = Lit.Directives.classMap({
@@ -1348,13 +1351,13 @@ function renderChatInput({
13481351
></textarea>
13491352
<div class="chat-input-buttons">
13501353
${renderTakeScreenshotButton({
1351-
multimodalInputEnabled, isTextInputDisabled, onTakeScreenshot
1354+
multimodalInputEnabled, blockedByCrossOrigin, isTextInputDisabled, onTakeScreenshot
13521355
})}
13531356
${renderChatInputButtons({ isLoading, blockedByCrossOrigin, isTextInputDisabled, onCancel, onNewConversation, onCancelCrossOriginChat })}
13541357
</div>
13551358
</div>
13561359
</form>`;
1357-
// clang-format on
1360+
// clang-format on
13581361
}
13591362

13601363
function renderAidaUnavailableContents(

front_end/panels/ai_assistance/components/chatView.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@
182182
/* cancel + start new chat button */
183183
--right-padding: 172px;
184184
}
185+
186+
&.screenshot-button {
187+
--right-padding:
188+
calc(
189+
2*var(--sys-size-3) + 2*26px
190+
); /* Gaps because of right paddings + width of two icons */
191+
}
185192
}
186193

187194
.chat-input-buttons {

0 commit comments

Comments
 (0)