react-component / tooltip

React Tooltip
http://react-component.github.io/tooltip/
MIT License
928 stars 190 forks source link

[not bug]why converting position property to inset property? #476

Closed jianqiao0313 closed 6 months ago

jianqiao0313 commented 7 months ago

image

hello, I'm a bit confused. I saw that the tooltip demo sets the inset property. However, when I look at the combination of the trigger and tooltip source code, I can't find any place where the position properties (top, right, bottom, left) are converted to the inset property.

thx

jianqiao0313 commented 6 months ago

Can someone help me?

yoyo837 commented 6 months ago

It's here https://github.com/react-component/trigger

jianqiao0313 commented 6 months ago

It's here https://github.com/react-component/trigger

https://github.com/react-component/trigger/blob/master/src/Popup/index.tsx#L149 Yes, I looked at the source code of 'trigger' and found that only 'left', 'top', 'bottom', and 'right' are defined; the 'inset' property is not used. Can you tell me where the logic for 'trigger' is handled?

thx :)

yoyo837 commented 6 months ago

package.json => father => postcss => browserslist/autoprefixer

jianqiao0313 commented 6 months ago

hi yoyo837: I reviewed the source code of the rc-tools project and found that postcss is used in the /lib/getWebpackCommonConfig.js file. Then I checked the source code of postcss and discovered that there is no code for converting the 'position' property into the 'inset' property. I only found that the npm package postcss-inset can convert 'inset' into 'position.' Finally, I searched the source code of browserslist, postcss-preset-env, and postcss-normalize, but I did not find any logic for handling 'inset'."

jianqiao0313 commented 6 months ago

package.json => father => postcss => browserslist/autoprefixer

大佬,你知道到底哪里把posiiton属性改成inset属性嘛?找了半天找不到啊。。。好尴尬。。。

yoyo837 commented 6 months ago
image image

上面的图片是我本地自测的,具体实现也许是这个吧,没细看 https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-logical/src/lib/transforms.ts#L51

yoyo837 commented 6 months ago

browserslist 配置不满足inset的兼容的话,是不会被合并的。

jianqiao0313 commented 6 months ago

感谢感谢,祝大佬永远没bug~