Skip to content

Keyboard support and more #7

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

gubrus50
Copy link

@gubrus50 gubrus50 commented Apr 8, 2025

Branch Update: Enhancements, Documentation, Styling Updates, Initial Testing, and Future Considerations for DynamicSelect

Contributor:

Gabriel Książek (McRaZick) | GitHub Profile

Contribution Period:

April 2, 2025 – April 8, 2025 (UTC-0)

Key Enhancements & Modifications:

  • Accessibility & Usability Improvements:
    • Added keyboard navigability to enhance accessibility.
    • Implemented support for the disabled attribute.
  • Structural & Semantic Refinements:
    • Replaced standard elements with custom semantic equivalents for improved clarity and maintainability.
    • Relocated id Attribute:

      The id attribute has been moved from <selection> to <dynamic-select>, ensuring direct targeting of the primary element. Previously, <dynamic-select> functioned as a wrapper <div>, but it has now been elevated in hierarchy to better define the component structure. This change is crucial because the tabindex attribute primarily operates on the main element, improving keyboard accessibility and interaction.

  • Customization & Extensibility:

    Introduced support for extending custom classes and styles across semantic elements.

  • Enhanced Functionality:
    • new DynamicSelect() now inherits options from the associated <select> element, allowing dynamic modification—such as adding new options or overwriting existing ones.
    • Placeholder Behavior Update:

      The placeholder will now display in the <selected> header unless a selected attribute or option is explicitly defined. In such cases, the specified selected element takes precedence and will be displayed in the <selected> header.

Documentation Updates & Newly Added Features:

  • New Configuration Options for Selection & Dropdown Elements
  • Enhanced Search & Navigation Functionality
  • Fallback Styling for <select> Element
  • Testing & Browser Compatibility Considerations

Styling Updates (SCSS & CSS Enhancements):

  • Updated SCSS and generated CSS assets (DynamicSelect.css & DynamicSelect.scss).
  • Added style support for the disabled attribute applied to <display-element>.
  • Improved styling for <item> options in dropdown selections.
  • Introduced CSS rules for custom HTML tags:
    • <item>
    • <selected>
    • <dropdown>
    • <selection>
    • <display-element>

Testing & Future Considerations:

  • Initial Testing:
    • The component has been tested extensively on Google Chrome, ensuring functional stability and styling flexibility.
    • Additional testing across multiple browsers may be required before merging into the main project.
  • Mouse-Free Interaction:

    Users are no longer dependent on a mouse to interact with <dynamic-select>, enhancing accessibility.

  • Dropdown Overflow & Event Bubbling Fixes:

    Multiple <display-element> objects have been tested to ensure no unwanted event bubbling when dropdowns overlap.

Performance & Code Improvement Considerations:

  • Newly implemented code is not yet commented, leaving room for future documentation improvements.
  • Optimization areas, particularly around loop iterations, are identified for future revisions.
  • Additional refinements may be needed to enhance efficiency.

Fork Availability:

The fork containing these changes will remain open for those who may find the features useful, even if they are not incorporated into the main project.

Additional comments may be removed from the .js script as long as the newly implemented features are appropriately credited.

Advanced Example:

For a more detailed implementation and practical use cases, refer to the advanced examples:

🔗 More Advanced Examples

gubrus50 added 21 commits April 2, 2025 13:42
+ Added support for Bootstrap .form-control styling (corrected border).
+ Added support for `tabulation` navigation.
+ Added focus style for selecting options with newly implemented keyboard navigation functionality.
RENAMED dynamic-selected-option-focus TO  dynamic-selected-focus AND placed it appropriately.
+ Added support for Bootstrap .form-control styling (Set DynamicSelect's option = { bootstrapForm: true }).
+ Added support for forward `tabulation` navigation.
+ Added support for backward `tabulation` navigation with `Shift+Tab`.
+ Added support for `Up & Down Arrow keys` navigation.
+ Added support for `forward & backward` search with other keyboard keys

+ Clients can also escape DynamicSelect's options dropdown, using `Esc` (Escape) keyboard button.
+ Clients can also toggle DynamicSelect's options dropdown, using `Space` (Space bar) keyboard button.

+ Client can also escape DynamicSelect's options dropdown, using both:
    forward and backward `tabulation` navigation, when there are no more options to iterate through.

+ UNICODE is supported. Hence, by hitting [Alt Gr] + [L] (using Polish Programmers Keyboard)
   you can search through options with textContent, where the first letter is: `ł` or `Ł` (This feature is NOT case-sensitive))
   You can also perform a backward search to find specific options, by holding `Shift` + `Any UNICODE Key`, keyboard buttons.

NOTE: Most added features work only when the client is focused on the DynamicSelect selection.
Included new options to the Example configuration
Fixed issue where many objects used to change options of one another unintensionally
When multiple dropdowns are open, clicking a new one should:

Close all other open dropdowns. and
Keep only the clicked dropdown open
…ty. Removed previouslly added support for Bootstrap, and more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant