[BUG] - Attempting To Select An Item From Dropdown That Is Within A Modal Does Not Cause OnAction To Trigger If Its Dismissible
BUG: Attempting to select an item from Dropdown that is within a Modal does not cause onAction to trigger if its dismissible
In this article, we will be discussing a bug that has been identified in the HeroUI version 2.7.2. The bug is related to the behavior of a Dropdown component that is placed inside a Modal. When the Modal is set to be dismissible, attempting to select an item from the Dropdown does not trigger the onAction function. This behavior is not as expected and can be frustrating for users who rely on this functionality.
The HeroUI version that is affected by this bug is 2.7.2. It is essential to note that this bug may have been fixed in later versions of HeroUI, but for users who are still using version 2.7.2, this bug can be a significant issue.
The bug is related to the behavior of a Dropdown component that is placed inside a Modal. When the Modal is set to be dismissible, attempting to select an item from the Dropdown does not trigger the onAction function. This behavior is not as expected and can be frustrating for users who rely on this functionality.
To reproduce this bug, follow these steps:
- Create a Modal with a Dropdown inside it with at least one DropdownItem and a function to handle the DropdownMenu's onAction.
- Open the modal and select an item inside the dropdown.
- See that the modal closes and the onAction function never gets triggered.
The expected behavior is that the onAction function gets triggered whenever it is clicked. This is the standard behavior of a Dropdown component, and it is what users would expect to happen when they select an item from the Dropdown.
The workaround for this bug is to set the Modal to not be dismissable. However, this means that users will not be able to close the Modal by clicking elsewhere on the screen. This can be frustrating for users who want to close the Modal without having to explicitly click a button.
To reproduce this bug, follow these steps:
Step 1: Create a Modal with a Dropdown inside it
Create a Modal with a Dropdown inside it with at least one DropdownItem and a function to handle the DropdownMenu's onAction.
<Modal isDismissable={true}>
<Dropdown>
<DropdownItem>Item 1</DropdownItem>
<DropdownItem>Item 2</DropdownItem>
</Dropdown>
</Modal>
Step 2: Open the modal and select an item inside the dropdown
Open the modal and select an item inside the dropdown.
const modal = document.querySelector('.modal');
modal.open();
const dropdown = document.querySelector('.dropdown');
dropdown.open();
const dropdownItem = document.querySelector('.dropdown-item');
dropdownItem.click();
Step 3: See that the modal closes and the onAction function never gets triggered
See that the modal closes and the onAction function never gets triggered.
const modal = document.querySelector('.modal');
console.log(modal.isOpen); // Should be false
const onAction = document.querySelector('.on-action');
console.log(onAction.triggered); // Should be false
The operating system version that was used to reproduce this bug is Windows.
The browser that was used to reproduce this bug is Chrome.
In conclusion, the bug that has been identified in the HeroUI version 2.7.2 is a significant issue that can be frustrating for users who rely on the functionality of a Dropdown component inside a Modal. The workaround for this bug is to set the Modal to not be dismissable, but this can be limiting for users who want to close the Modal without having to explicitly click a button. It is essential to note that this bug may have been fixed in later versions of HeroUI, but for users who are still using version 2.7.2, this bug can be a significant issue.
Q&A: BUG - Attempting to select an item from Dropdown that is within a Modal does not cause onAction to trigger if its dismissible
A: The bug that is being discussed in this article is related to the behavior of a Dropdown component that is placed inside a Modal. When the Modal is set to be dismissible, attempting to select an item from the Dropdown does not trigger the onAction function.
A: The expected behavior of a Dropdown component inside a Modal is that the onAction function gets triggered whenever it is clicked. This is the standard behavior of a Dropdown component, and it is what users would expect to happen when they select an item from the Dropdown.
A: The workaround for this bug is to set the Modal to not be dismissable. However, this means that users will not be able to close the Modal by clicking elsewhere on the screen. This can be frustrating for users who want to close the Modal without having to explicitly click a button.
A: This bug is a significant issue because it can be frustrating for users who rely on the functionality of a Dropdown component inside a Modal. The bug can prevent users from performing certain actions, which can be limiting and frustrating.
A: It is possible that this bug has been fixed in later versions of HeroUI. However, for users who are still using version 2.7.2, this bug can be a significant issue.
A: To reproduce this bug, follow these steps:
- Create a Modal with a Dropdown inside it with at least one DropdownItem and a function to handle the DropdownMenu's onAction.
- Open the modal and select an item inside the dropdown.
- See that the modal closes and the onAction function never gets triggered.
A: The operating system version that was used to reproduce this bug is Windows. The browser that was used to reproduce this bug is Chrome.
A: The HeroUI version that is affected by this bug is 2.7.2.
A: Unfortunately, there is no way to fix this bug without upgrading to a later version of HeroUI. However, you can try using the workaround of setting the Modal to not be dismissable.
A: Yes, you can try contacting the HeroUI team for help in fixing this bug. They may be able to provide you with a patch or a workaround to fix the issue.
A: Yes, this bug is a known issue in the HeroUI community. You can search for discussions and threads related to this bug on the HeroUI forums or social media channels.