-
Notifications
You must be signed in to change notification settings - Fork 833
nothing to see, test #3119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
nothing to see, test #3119
Changes from all commits
bcd1412
c666a84
a16ef67
b1898c7
4463f1a
efb99cc
f90b3e4
6e43d1b
d2559dc
34886ba
6118a77
87d4838
ac0a7b6
20e3a91
b543171
db11112
7f799d0
a03e09a
0b9f67c
848697e
9ef4f18
f109a3e
3d31cd8
6f96cab
ee90da8
45a8e33
aa25785
f134e5b
dbf2d34
978b7fc
f6df2cc
3137d8b
813c502
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| import { LitElement, html } from "lit"; | ||||||||||||||||||||||||||||||||||||||||||||
| import { customElement, property } from "lit/decorators.js"; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| export type SettingSelectOption = { value: string; label: string }; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| @customElement("setting-select") | ||||||||||||||||||||||||||||||||||||||||||||
| export class SettingSelect extends LitElement { | ||||||||||||||||||||||||||||||||||||||||||||
| @property() label = "Setting"; | ||||||||||||||||||||||||||||||||||||||||||||
| @property() description = ""; | ||||||||||||||||||||||||||||||||||||||||||||
| @property() id = ""; | ||||||||||||||||||||||||||||||||||||||||||||
| @property() value = ""; | ||||||||||||||||||||||||||||||||||||||||||||
| @property({ attribute: false }) options: SettingSelectOption[] = []; | ||||||||||||||||||||||||||||||||||||||||||||
| @property({ type: Boolean }) easter = false; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| createRenderRoot() { | ||||||||||||||||||||||||||||||||||||||||||||
| return this; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| private handleChange(e: Event) { | ||||||||||||||||||||||||||||||||||||||||||||
| const select = e.target as HTMLSelectElement; | ||||||||||||||||||||||||||||||||||||||||||||
| this.value = select.value; | ||||||||||||||||||||||||||||||||||||||||||||
| this.dispatchEvent( | ||||||||||||||||||||||||||||||||||||||||||||
| new CustomEvent("change", { | ||||||||||||||||||||||||||||||||||||||||||||
| detail: { value: this.value }, | ||||||||||||||||||||||||||||||||||||||||||||
| bubbles: true, | ||||||||||||||||||||||||||||||||||||||||||||
| composed: true, | ||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n src/client/components/baseComponents/setting/SettingSelect.tsRepository: openfrontio/OpenFrontIO Length of output: 2537 🌐 Web query:
💡 Result:
Sources: Lit “Working with Shadow DOM” (render root / Stop the native change event from propagating. This component uses light DOM (see Use Fix: prevent native event from bubbling private handleChange(e: Event) {
+ e.stopPropagation();
const select = e.target as HTMLSelectElement;
this.value = select.value;
this.dispatchEvent(
new CustomEvent("change", {
detail: { value: this.value },
bubbles: true,
composed: true,
}),
);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| render() { | ||||||||||||||||||||||||||||||||||||||||||||
| const rainbowClass = this.easter | ||||||||||||||||||||||||||||||||||||||||||||
| ? "bg-[linear-gradient(270deg,#990033,#996600,#336600,#008080,#1c3f99,#5e0099,#990033)] bg-[length:1400%_1400%] animate-rainbow-bg text-white hover:bg-[linear-gradient(270deg,#990033,#996600,#336600,#008080,#1c3f99,#5e0099,#990033)]" | ||||||||||||||||||||||||||||||||||||||||||||
| : ""; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| return html` | ||||||||||||||||||||||||||||||||||||||||||||
| <div | ||||||||||||||||||||||||||||||||||||||||||||
| class="flex flex-row items-center justify-between w-full p-4 bg-white/5 border border-white/10 rounded-xl hover:bg-white/10 transition-all gap-4 ${rainbowClass}" | ||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||
| <div class="flex flex-col flex-1 min-w-0 mr-4"> | ||||||||||||||||||||||||||||||||||||||||||||
| <div class="text-white font-bold text-base block mb-1"> | ||||||||||||||||||||||||||||||||||||||||||||
| ${this.label} | ||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||
| <div class="text-white/50 text-sm leading-snug"> | ||||||||||||||||||||||||||||||||||||||||||||
| ${this.description} | ||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| <select | ||||||||||||||||||||||||||||||||||||||||||||
| id=${this.id} | ||||||||||||||||||||||||||||||||||||||||||||
| class="shrink-0 bg-black/60 border border-white/10 text-white/90 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-600" | ||||||||||||||||||||||||||||||||||||||||||||
| .value=${this.value} | ||||||||||||||||||||||||||||||||||||||||||||
| @change=${this.handleChange} | ||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||
| ${this.options.map( | ||||||||||||||||||||||||||||||||||||||||||||
| (o) => html`<option value=${o.value}>${o.label}</option>`, | ||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
| </select> | ||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n src/client/components/baseComponents/setting/SettingSelect.ts | head -60Repository: openfrontio/OpenFrontIO
Length of output: 2517
🏁 Script executed:
Repository: openfrontio/OpenFrontIO
Length of output: 559
🏁 Script executed:
rg "<setting-select" -A 1 -B 1Repository: openfrontio/OpenFrontIO
Length of output: 49
🏁 Script executed:
rg "SettingSelect" --type ts -lRepository: openfrontio/OpenFrontIO
Length of output: 159
🏁 Script executed:
cat -n src/client/UserSettingModal.ts | head -100Repository: openfrontio/OpenFrontIO
Length of output: 3791
🏁 Script executed:
Repository: openfrontio/OpenFrontIO
Length of output: 49
🏁 Script executed:
cat -n src/client/UserSettingModal.ts | tail -100Repository: openfrontio/OpenFrontIO
Length of output: 4296
🏁 Script executed:
rg "setting-select" src/client/UserSettingModal.ts -A 5 -B 2Repository: openfrontio/OpenFrontIO
Length of output: 49
🏁 Script executed:
Repository: openfrontio/OpenFrontIO
Length of output: 101
🏁 Script executed:
Repository: openfrontio/OpenFrontIO
Length of output: 448
🏁 Script executed:
Repository: openfrontio/OpenFrontIO
Length of output: 163
Use
<label>withforattribute and separate the select ID from the host element ID.The label is currently a
<div>, so screen readers won't associate it with the<select>. Additionally, if the host element receives anidattribute, it duplicates on the inner<select>because@property() idmirrors to the select element, creating two elements with the same ID. Use a dedicatedselectIdproperty and properly labeled<label>element instead.Suggested structure
This also applies to lines 40–52 in the render method.
🤖 Prompt for AI Agents