-
-
Notifications
You must be signed in to change notification settings - Fork 163
feat(virtual-lab): add dropdown menu for Chemistry experiments #936
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?
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,8 @@ | |||||||||||||||||||||||||||||||||||||||||
| <button class="hover:text-indigo-600 dark:hover:text-indigo-400 transition focus:outline-none focus:ring-2 focus:ring-indigo-500"> | ||||||||||||||||||||||||||||||||||||||||||
| {% trans "Physics" %} | ||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||
| <div class="absolute left-0 mt-2 w-40 bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition pointer-events-none group-hover:pointer-events-auto group-focus-within:pointer-events-auto"> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <div class="absolute left-0 mt-2 w-40 bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition pointer-events-none group-hover:pointer-events-auto group-focus-within:pointer-events-auto "> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:physics_pendulum' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-indigo-50 dark:hover:bg-indigo-900 transition">{% trans "Pendulum" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:physics_projectile' %}" | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -29,9 +30,25 @@ | |||||||||||||||||||||||||||||||||||||||||
| class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-yellow-50 dark:hover:bg-yellow-900 transition">{% trans "Inclined Plane" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:chemistry_home' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="hover:text-indigo-600 dark:hover:text-indigo-400 transition">{% trans "Chemistry" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:code_editor' %}" | ||||||||||||||||||||||||||||||||||||||||||
| <!-- Chemistry Dropdown --> | ||||||||||||||||||||||||||||||||||||||||||
| <div class="relative group inline-block"> | ||||||||||||||||||||||||||||||||||||||||||
| <button class="hover:text-indigo-600 dark:hover:text-indigo-400 transition focus:outline-none focus:ring-2 focus:ring-indigo-500"> | ||||||||||||||||||||||||||||||||||||||||||
| {% trans "Chemistry" %} | ||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||
| <div class="absolute left-0 mt-2 w-40 bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition pointer-events-none group-hover:pointer-events-auto group-focus-within:pointer-events-auto z-50"> | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+35
to
+38
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. Missing ARIA attributes on dropdown button and menu container The
♿ Proposed fix — add ARIA attributes- <button class="hover:text-indigo-600 dark:hover:text-indigo-400 transition focus:outline-none focus:ring-2 focus:ring-indigo-500">
+ <button type="button"
+ aria-haspopup="true"
+ aria-expanded="false"
+ class="hover:text-indigo-600 dark:hover:text-indigo-400 transition focus:outline-none focus:ring-2 focus:ring-indigo-500">
{% trans "Chemistry" %}
</button>
- <div class="absolute left-0 mt-2 w-40 bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition pointer-events-none group-hover:pointer-events-auto group-focus-within:pointer-events-auto z-50">
+ <div role="menu"
+ aria-label="{% trans "Chemistry experiments" %}"
+ class="absolute left-0 mt-2 w-40 bg-white dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md shadow-lg opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition pointer-events-none group-hover:pointer-events-auto group-focus-within:pointer-events-auto z-50">Note: 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:titration' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-indigo-50 dark:hover:bg-indigo-900 transition">{% trans "Titration" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:reaction_rate' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-green-50 dark:hover:bg-green-900 transition">{% trans "Reaction Rate" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:solubility' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-yellow-50 dark:hover:bg-yellow-900 transition">{% trans "Solubility" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:precipitation' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-purple-50 dark:hover:bg-purple-900 transition">{% trans "Precipitation" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:ph_indicator' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-teal-50 dark:hover:bg-teal-900 transition">{% trans "pH Indicator" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
+48
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. Chemistry dropdown links violate the prescribed Tailwind link color classes The new links use 🎨 Proposed fix — apply correct link color classes- <a href="{% url 'virtual_lab:titration' %}"
- class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-indigo-50 dark:hover:bg-indigo-900 transition">{% trans "Titration" %}</a>
- <a href="{% url 'virtual_lab:reaction_rate' %}"
- class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-green-50 dark:hover:bg-green-900 transition">{% trans "Reaction Rate" %}</a>
- <a href="{% url 'virtual_lab:solubility' %}"
- class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-yellow-50 dark:hover:bg-yellow-900 transition">{% trans "Solubility" %}</a>
- <a href="{% url 'virtual_lab:precipitation' %}"
- class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-purple-50 dark:hover:bg-purple-900 transition">{% trans "Precipitation" %}</a>
- <a href="{% url 'virtual_lab:ph_indicator' %}"
- class="block px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-teal-50 dark:hover:bg-teal-900 transition">{% trans "pH Indicator" %}</a>
+ <a href="{% url 'virtual_lab:titration' %}"
+ class="block px-4 py-2 text-blue-600 hover:text-blue-800 dark:text-blue-400 hover:bg-indigo-50 dark:hover:bg-indigo-900 transition">{% trans "Titration" %}</a>
+ <a href="{% url 'virtual_lab:reaction_rate' %}"
+ class="block px-4 py-2 text-blue-600 hover:text-blue-800 dark:text-blue-400 hover:bg-green-50 dark:hover:bg-green-900 transition">{% trans "Reaction Rate" %}</a>
+ <a href="{% url 'virtual_lab:solubility' %}"
+ class="block px-4 py-2 text-blue-600 hover:text-blue-800 dark:text-blue-400 hover:bg-yellow-50 dark:hover:bg-yellow-900 transition">{% trans "Solubility" %}</a>
+ <a href="{% url 'virtual_lab:precipitation' %}"
+ class="block px-4 py-2 text-blue-600 hover:text-blue-800 dark:text-blue-400 hover:bg-purple-50 dark:hover:bg-purple-900 transition">{% trans "Precipitation" %}</a>
+ <a href="{% url 'virtual_lab:ph_indicator' %}"
+ class="block px-4 py-2 text-blue-600 hover:text-blue-800 dark:text-blue-400 hover:bg-teal-50 dark:hover:bg-teal-900 transition">{% trans "pH Indicator" %}</a>As per coding guidelines: "Use Tailwind link classes: 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||
| <a href="{% url 'virtual_lab:code_editor' %}" | ||||||||||||||||||||||||||||||||||||||||||
| class="hover:text-indigo-600 dark:hover:text-indigo-400 transition">{% trans "Code Editor" %}</a> | ||||||||||||||||||||||||||||||||||||||||||
| </nav> | ||||||||||||||||||||||||||||||||||||||||||
| </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.
z-50applied only to Chemistry dropdown — Physics dropdown risks being overlaidThe Chemistry dropdown menu (line 38) includes
z-50, but the Physics dropdown menu (line 24) does not. Because both containers areposition: relative; display: inline-blocksiblings and the Chemistry container appears later in DOM order, the Chemistry container's default stacking order naturally sits above the Physics dropdown menu. Without an explicit z-index on the Physics dropdown, its items can be obscured by the Chemistry container's stacking context, making those items unreachable.Add
z-50to the Physics dropdown menu div to match:🐛 Proposed fix — add `z-50` to Physics dropdown
Also applies to: 38-38
🤖 Prompt for AI Agents
Trailing whitespace and extra leading space in the Physics dropdown
<div>classLine 24 has a stray leading space (
⎵<div) and a trailing space inside the class string (…pointer-events-auto⎵"). These are cosmetic artifacts from the edit but can cause noise in diffs.🤖 Prompt for AI Agents