GithubHelp home page GithubHelp logo

[Bug]: Combobox style about fluentui HOT 4 OPEN

Fn4ch avatar Fn4ch commented on June 21, 2024
[Bug]: Combobox style

from fluentui.

Comments (4)

ValentinaKozlova avatar ValentinaKozlova commented on June 21, 2024

Hello @Fn4ch , could you please provide system info? What browser do you use?
I can't reproduce it. Tried on Chrome, Edge and Firefox.
image

from fluentui.

Fn4ch avatar Fn4ch commented on June 21, 2024

Hello @Fn4ch , could you please provide system info? What browser do you use? I can't reproduce it. Tried on Chrome, Edge and Firefox. image

Im using Chrome 125.0.6422.78, and i got this problem everywhere
SpinButton example:
image

from fluentui.

ValentinaKozlova avatar ValentinaKozlova commented on June 21, 2024

Hello @Fn4ch , could you please provide system info? What browser do you use? I can't reproduce it. Tried on Chrome, Edge and Firefox. ![image](https://private-user-images.githubusercontent.com/11574680/332428249-f3c60d66-ab5c-4c58-91d0-27afabe3b671.png?

Could you please send codesandbox or codepen example of how you use the component? Because it's not reproducible on our side

from fluentui.

Fn4ch avatar Fn4ch commented on June 21, 2024

image
Win 10 pro

deps:
react and etc
"@fluentui/react-components": "^9.53.0",
"@fluentui/react-icons": "^2.0.237",
"@storybook/react": "^8.0.9",
"@storybook/react-vite": "^8.0.9",

This component (Combobox) is shown through the storybook

My component:

import * as React from "react"
import { useState, useEffect } from "react"
import {
  Combobox,
  makeStyles,
  shorthands,
  useId,
  useComboboxFilter
} from "@fluentui/react-components"
import type { ComboboxProps } from "@fluentui/react-components"
import { MultipleComboboxProps } from "@/shared/models"

const useStyles = makeStyles({
  root: {
    display: "grid",
    gridTemplateRows: "repeat(1fr)",
    justifyItems: "start",
    ...shorthands.gap("2px"),
    maxWidth: "400px",
  },
})

const MultipleCombobox = (props: MultipleComboboxProps) => {
  const {
    options = [],
    placeholder = '',
    labelTitle = '',
    selectedValue = [],
    onSelectOptionsChange
  } = props

  const comboId = useId("combo-source")
  const selectedListId = `${comboId}-selection`
  const [value, setValue] = useState('')
  const styles = useStyles()

  const onSelect: ComboboxProps["onOptionSelect"] = (event, data) => {
    onSelectOptionsChange(data.selectedOptions)
    setValue("")
  }

  useEffect(() => {
    if(selectedValue.length === 0){
      setValue('')
    }
  }, [selectedValue])

  const children = useComboboxFilter(value, options, {
    noOptionsMessage: "Nothing was found for your request",
  })

  const onFocus = () => {
    setValue("")
  }

  const onBlur = () => {
    setValue(selectedValue.join(", "))
  }

  const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    setValue(event.target.value)
  }

  useEffect(() => {
    const comboboxes = document.querySelectorAll('[role="combobox"]')
    comboboxes.forEach(c => c.classList.remove('f1ub7u0d'))
  }, [])

  return (
    <div className={styles.root}>
      <label id={comboId}
        style={{fontWeight: 600}}
      >{labelTitle}</label>
      <Combobox
        aria-labelledby={comboId}
        multiselect
        placeholder={placeholder}
        selectedOptions={selectedValue}
        value={value}
        onBlur={onBlur}
        onChange={onChange}
        onFocus={onFocus}
        onOptionSelect={onSelect}
        {...props}
      >
        {children}
      </Combobox>
    </div>
  )
}

export default MultipleCombobox

Im using useEffect, to delete style: allign-self: stretch

from fluentui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.