Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user_status: Improve selectable default user status options styling.

Sayam Samal6f6e3b9f48fd
diff --git a/web/e2e-tests/user-status.test.ts b/web/e2e-tests/user-status.test.ts
index f794fa0807f..dc2e638da69 100644
--- a/web/e2e-tests/user-status.test.ts
+++ b/web/e2e-tests/user-status.test.ts
@@ -18,7 +18,7 @@ async function open_set_user_status_modal(page: Page): Promise<void> {
async function test_user_status(page: Page): Promise<void> {
await open_set_user_status_modal(page);
// Check by clicking on common statues.
- await page.click(".user-status-value:nth-child(2)");
+ await page.click(".user-status-option:nth-child(2) .user-status-value");
await page.waitForFunction(
() => document.querySelector<HTMLInputElement>(".user-status")!.value === "In a meeting",
);
diff --git a/web/styles/modal.css b/web/styles/modal.css
index 29a684c671b..c8c7ad13368 100644
--- a/web/styles/modal.css
+++ b/web/styles/modal.css
@@ -732,3 +732,43 @@
}
}
}
+
+ul.modal-options-list {
+ list-style: none;
+ margin: 0;
+}
+
+.modal-option-content {
+ box-sizing: border-box;
+ display: flex;
+ flex-flow: row nowrap;
+ align-items: flex-start;
+ gap: 0.4375em; /* 7px at 16px/1em */
+ padding: 0.25em 0.5em; /* 4px 8px at 16px/1em */
+ line-height: 1.25em; /* 20px at 16px/1em */
+ color: var(--color-text-default);
+ border-radius: 4px;
+
+ &:focus {
+ /* Override the default focus style */
+ outline: none !important;
+ color: inherit;
+ text-decoration: none;
+ }
+
+ &:hover,
+ &:focus-visible {
+ color: var(--color-text-default);
+ background: var(--color-background-hover-popover-menu);
+ text-decoration: none;
+ }
+
+ &:focus-visible {
+ outline: 1px solid var(--color-outline-focus) !important;
+ outline-offset: -1px;
+ }
+
+ &:active {
+ background: var(--color-background-active-popover-menu);
+ }
+}
diff --git a/web/styles/user_status.css b/web/styles/user_status.css
index 203710d4f78..e6522c9f52b 100644
--- a/web/styles/user_status.css
+++ b/web/styles/user_status.css
@@ -65,28 +65,14 @@
.user-status-options {
padding-top: 15px;
- padding-left: 2px;
-
- & button.user-status-value:hover,
- & button.user-status-value:focus {
- /* Important is required for generic night them styling to not
- have precedence over this. */
- color: var(--color-text-url) !important;
- }
.user-status-value {
- display: flex;
- align-items: center;
- width: 100%;
- padding: 3.5px 0;
- line-height: 1em;
-
.status-emoji {
/* Size and align status emoji to match
the top line of the modal. */
height: 1.25em; /* 20px at 16px/em */
width: 1.25em; /* 20px at 16px/em */
- margin: 0 7px;
+ margin: 0;
}
}
}
diff --git a/web/templates/set_status_overlay.hbs b/web/templates/set_status_overlay.hbs
index 2eca63ff746..cb8082a0a31 100644
--- a/web/templates/set_status_overlay.hbs
+++ b/web/templates/set_status_overlay.hbs
@@ -9,17 +9,19 @@
<i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
</button>
</div>
-<div class="user-status-options">
+<ul class="user-status-options modal-options-list">
{{#each default_status_messages_and_emoji_info}}
- <button type="button" class="button no-style user-status-value">
- {{#if emoji.emoji_alt_code}}
- <div class="emoji_alt_code">&nbsp;:{{emoji.emoji_name}}:</div>
- {{else if emoji.url}}
- <img src="{{emoji.url}}" class="emoji status-emoji" />
- {{else}}
- <div class="emoji status-emoji emoji-{{emoji.emoji_code}}"></div>
- {{/if}}
- {{status_text}}
- </button>
+ <li class="user-status-option">
+ <a class="modal-option-content trigger-click-on-enter user-status-value" tabindex="0">
+ {{#if emoji.emoji_alt_code}}
+ <div class="emoji_alt_code">&nbsp;:{{emoji.emoji_name}}:</div>
+ {{else if emoji.url}}
+ <img src="{{emoji.url}}" class="emoji status-emoji" />
+ {{else}}
+ <div class="emoji status-emoji emoji-{{emoji.emoji_code}}"></div>
+ {{/if}}
+ <span class="status-text">{{status_text}}</span>
+ </a>
+ </li>
{{/each}}
-</div>
+</ul>