Skip to content

How can i style the listbox element in the #shadow-root of FluentSelect #714

Answered by madcoda9000
madcoda9000 asked this question in Q&A
Discussion options

You must be logged in to vote

ok, i found it by myself:

Just if someone is interested...

Javascript:

function StyleRolesList() {
    // Step 1: Select the host element (replace '.host-element' with the appropriate selector)
    var hostElement = document.querySelectorAll('.rolesList');

    if(hostElement[0]) {
        // Step 2: Access the shadow DOM        
        var shadowRoot = hostElement[0].shadowRoot;
        // Step 3: Select and style the shadow DOM element
        var listboxElements = shadowRoot.querySelectorAll('.listbox'); // Replace '.listbox' with your desired selector
        listboxElements[0].style.boxShadow = 'none'; // Apply your desired box-shadow
    }
    
}

Result:

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@vnbaaij
Comment options

@madcoda9000
Comment options

Answer selected by madcoda9000
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants