Skip to content
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

[UX] Disabling tabs #209

Open
wants to merge 2 commits into
base: 5.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/design/disabling_elements.rst
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on heading nesting, this is using the wrong underlines.

H1 ###
H2 ***
H3 ===
H4 ---
H5 ~~~

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Disabling interface elements
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Disabling interface elements
Making interface elements inactive or unavailable

Let's not use disabling and instead talk about what we're actually doing - making something inactive or unavailable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're doing this: making users become not allowed to interact with that thing, effectively removing their ability of taking actions

in the code, we use:
cursor: not-allowed;
to show the red X cursor as a feedback

another way to say is that we're removing pointer events, as this attribute is also appended to ensure users have their most deep desire and wishes to interact completely blocked:
pointer-events: none;

how would you find better to call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's great to pick 1 word to avoid having the synonyms (inactive or unavailable) there in every use

=======================================

The state of interface elements is a crucial aspect of user interface design, providing visual feedback and preventing interaction when certain actions aren't allowed.

Disabling tabs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Disabling tabs
Changing tab states

--------------

We use the following CSS code to style disabled tabs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We use the following CSS code to style disabled tabs:
Use the following CSS code to style inactive or unavailable tabs:


.. code-block:: css

.nav-tabs.nav-tabs-contained > li.disabled {
cursor: not-allowed;
color: var(--text-disabled);
}

.nav-tabs.nav-tabs-contained > li.disabled > a {
background-color: var(--button-disabled);
pointer-events: none;
}

This CSS accomplishes the following:

* Sets the cursor to ``not-allowed`` for disabled tabs, indicating that interaction is prohibited.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Sets the cursor to ``not-allowed`` for disabled tabs, indicating that interaction is prohibited.
* Sets the cursor to ``not-allowed`` for inactive or unavailable tabs, indicating that interaction is prohibited.

* Changes the text color to a predefined disabled state color.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Changes the text color to a predefined disabled state color.
* Changes the text color to a predefined inactive or unavailable state color.

* Modifies the background color of the tab to visually represent its disabled state.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Modifies the background color of the tab to visually represent its disabled state.
* Modifies the background color of the tab to visually represent its inactive or unavailable state.

* Prevent click events on the tab using ``pointer-events: none``.

To dynamically disable tabs, we use JavaScript to add or remove the ``disabled`` class. Here's an example function:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To dynamically disable tabs, we use JavaScript to add or remove the ``disabled`` class. Here's an example function:
To dynamically deactivate tabs, use JavaScript to add or remove the ``disabled`` class. Here's an example function:


.. code-block:: javascript

Mautic.togglePermissionVisibility = function () {
setTimeout(function () {
if (mQuery('#role_isAdmin_0').prop('checked')) {
mQuery('#permissions-tab').removeClass('disabled');
} else {
mQuery('#permissions-tab').addClass('disabled');
}
}, 10);
};

This function:

* Checks the state of a checkbox - ``#role_isAdmin_0``.
* Adds or removes the ``disabled`` class from the permissions tab based on the checkbox state.

To implement disabled states for tabs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To implement disabled states for tabs:
To implement inactive or unavailable states for tabs:


1. Assign unique IDs to your tab elements.
2. Use JavaScript to toggle the ``disabled`` class on the appropriate ``<li>`` elements.

.. note::
Always use disabled states instead of hiding elements.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Always use disabled states instead of hiding elements.
Always use inactive or unavailable states instead of hiding elements.

1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ There are several ways to support Mautic other than contributing with code.
:hidden:

design/retrieving_system_settings
design/disabling_elements

.. toctree::
:maxdepth: 2
Expand Down