Skip to content

Commit f710384

Browse files
feat(Chatbot): Add support for high contrast (#711)
Add borders to container that show in high contrast mode. Also fixes an older drawer bug pointed out by @srambach - it was adding a border to the ChatBot on mobile, when drawer styling changes from inline to more of a block layout. We should add it only when we need it on the drawer.
1 parent d2fc306 commit f710384

3 files changed

Lines changed: 55 additions & 1 deletion

File tree

packages/module/src/Chatbot/Chatbot.scss

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
opacity: 1;
2929
transform: translateY(0);
3030
}
31+
// for high contrast support
32+
border: var(--pf-t--global--border--width--high-contrast--regular) solid
33+
var(--pf-t--global--border--color--high-contrast);
3134

3235
// 32 rem is the width of the overlay chatbot plus the insets
3336
// if the screen is smaller, we want to be 100%
@@ -46,6 +49,10 @@
4649
// Chatbot Display Mode - Docked
4750
// ============================================================================
4851
.pf-chatbot--docked {
52+
// for high contrast support
53+
border: unset;
54+
border-left: var(--pf-t--global--border--width--high-contrast--regular) solid
55+
var(--pf-t--global--border--color--high-contrast);
4956
inset-block-end: 0;
5057
inset-inline-end: 0;
5158
padding: 0;
@@ -65,6 +72,8 @@
6572
// Chatbot Display Mode - Fullscreen
6673
// ============================================================================
6774
.pf-chatbot--fullscreen {
75+
// for high contrast support
76+
border: unset;
6877
inset-block-end: 0;
6978
inset-inline-end: 0;
7079
padding: 0;
@@ -78,6 +87,8 @@
7887
// Chatbot Display Mode - Embedded
7988
// ============================================================================
8089
.pf-chatbot--embedded {
90+
// for high contrast support
91+
border: unset;
8192
position: static;
8293
width: 100%;
8394
min-height: 100%;
@@ -125,12 +136,23 @@
125136
height: 100%;
126137
border-radius: 0;
127138
box-shadow: none;
128-
border-left: var(--pf-t--global--border--width--divider--default) solid;
129139
border-color: var(--pf-t--global--border--color--default);
130140

131141
.pf-chatbot-container {
132142
border-radius: var(--pf-t--global--border--radius--sharp);
133143
}
144+
145+
@media screen and (min-width: 768px) {
146+
// only want if drawer open - drawer closes/stops being inline on mobile
147+
border-left: var(--pf-t--global--border--width--divider--default) solid;
148+
}
149+
}
150+
151+
// for high contrast support
152+
:root:where(.pf-v6-theme-high-contrast) {
153+
.pf-chatbot--drawer {
154+
border: unset;
155+
}
134156
}
135157

136158
// ============================================================================

packages/module/src/ChatbotFooter/ChatbotFooter.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,20 @@
6666
padding: 0 var(--pf-t--global--spacer--sm) var(--pf-t--global--spacer--sm) var(--pf-t--global--spacer--sm);
6767
row-gap: var(--pf-t--global--spacer--sm);
6868
}
69+
70+
// ============================================================================
71+
// High contrast
72+
// ============================================================================
73+
:root:where(.pf-v6-theme-high-contrast) {
74+
// Chatbot Display Mode - Fullscreen and Embedded
75+
@media screen and (min-width: 64rem) {
76+
.pf-chatbot--embedded,
77+
.pf-chatbot--fullscreen {
78+
.pf-chatbot__footer {
79+
.pf-v6-c-divider {
80+
display: var(--pf-v6-hidden-visible--Display);
81+
}
82+
}
83+
}
84+
}
85+
}

packages/module/src/ChatbotHeader/ChatbotHeader.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,18 @@
162162
.pf-chatbot__header .pf-chatbot__actions .pf-v6-c-menu-toggle.pf-m-secondary.pf-m-compact {
163163
width: initial;
164164
}
165+
166+
// ============================================================================
167+
// High contrast
168+
// ============================================================================
169+
:root:where(.pf-v6-theme-high-contrast) {
170+
// Chatbot Display Mode - Fullscreen and Embedded
171+
@media screen and (min-width: 64rem) {
172+
.pf-chatbot--fullscreen,
173+
.pf-chatbot--embedded {
174+
.pf-chatbot__header__divider {
175+
display: var(--pf-v6-hidden-visible--Display);
176+
}
177+
}
178+
}
179+
}

0 commit comments

Comments
 (0)