Unverified Commit 2cb5aaaf authored by Guilherme Gazzo's avatar Guilherme Gazzo Committed by GitHub
Browse files

fix: Safari not triggering buttons anchors (#146)

parent 60080da8
......@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.2.0-alpha.29](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.28...v0.2.0-alpha.29) (2020-02-10)
**Note:** Version bump only for package Rocket.Chat.Fuselage
# [0.2.0-alpha.28](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.27...v0.2.0-alpha.28) (2020-02-10)
......
{
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
......
......@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.2.0-alpha.29](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.28...v0.2.0-alpha.29) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/fuselage-hooks
# [0.2.0-alpha.28](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.27...v0.2.0-alpha.28) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/fuselage-hooks
......
{
"name": "@rocket.chat/fuselage-hooks",
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"description": "React Hooks for Fuselage, Rocket.Chat's design system",
"homepage": "https://rocket.chat/Rocket.Chat.Fuselage",
"author": {
......
......@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.2.0-alpha.29](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.28...v0.2.0-alpha.29) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/fuselage-tokens
# [0.2.0-alpha.28](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.27...v0.2.0-alpha.28) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/fuselage-tokens
......
{
"name": "@rocket.chat/fuselage-tokens",
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"description": "Design tokens for Fuselage, Rocket.Chat's design system",
"homepage": "https://rocket.chat/Rocket.Chat.Fuselage",
"author": {
......
......@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.2.0-alpha.29](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.28...v0.2.0-alpha.29) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/fuselage-ui-kit
# [0.2.0-alpha.28](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.27...v0.2.0-alpha.28) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/fuselage-ui-kit
......
{
"name": "@rocket.chat/fuselage-ui-kit",
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "@rocket.chat/fuselage-ui-kit",
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"description": "Package ui kit ",
"author": "Guilherme Gazzo <guilhermegazzo@gmail.com>",
"homepage": "https://github.com/RocketChat/Rocket.Chat.Fuselage#readme",
......@@ -35,7 +35,7 @@
"url": "https://github.com/RocketChat/Rocket.Chat.Fuselage/issues"
},
"dependencies": {
"@rocket.chat/ui-kit": "^0.2.0-alpha.28"
"@rocket.chat/ui-kit": "^0.2.0-alpha.29"
},
"peerDependencies": {
"@rocket.chat/fuselage": "^0.2.0-alpha.23",
......@@ -47,7 +47,7 @@
"@babel/plugin-transform-runtime": "^7.5.0",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.7.4",
"@rocket.chat/fuselage": "^0.2.0-alpha.28",
"@rocket.chat/fuselage": "^0.2.0-alpha.29",
"@storybook/addon-actions": "5.2.4",
"@storybook/addon-backgrounds": "5.2.4",
"@storybook/addon-centered": "5.2.4",
......
......@@ -22,18 +22,21 @@ export const Overflow = ({ context, options, parser, ...element }) => {
hide();
});
const ref = useRef();
const onClick = useCallback(() => ref.current.focus() & show(), []);
const handleSelection = useCallback((...args) => {
fireChange(...args);
reset();
hide();
}, []);
const ref = useRef();
return (
<>
<Button
ref={ref}
small
ghost onClick={show}
ghost
onClick={onClick}
onBlur={hide}
onKeyUp={handleKeyUp}
onKeyDown={handleKeyDown}
......
......@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.2.0-alpha.29](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.28...v0.2.0-alpha.29) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/fuselage
# [0.2.0-alpha.28](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.27...v0.2.0-alpha.28) (2020-02-10)
......
{
"name": "@rocket.chat/fuselage",
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
......@@ -48,7 +48,7 @@
"@babel/preset-env": "^7.7.6",
"@babel/preset-react": "^7.7.4",
"@rocket.chat/eslint-config": "^0.4.0",
"@rocket.chat/fuselage-hooks": "^0.2.0-alpha.28",
"@rocket.chat/fuselage-hooks": "^0.2.0-alpha.29",
"@storybook/addon-actions": "5.2.8",
"@storybook/addon-backgrounds": "5.2.8",
"@storybook/addon-centered": "5.2.8",
......@@ -120,8 +120,8 @@
}
},
"dependencies": {
"@rocket.chat/fuselage-tokens": "^0.2.0-alpha.28",
"@rocket.chat/icons": "^0.2.0-alpha.28"
"@rocket.chat/fuselage-tokens": "^0.2.0-alpha.29",
"@rocket.chat/icons": "^0.2.0-alpha.29"
},
"browserslist": {
"production": [
......
......@@ -58,20 +58,19 @@ export const Position = ({ anchor, width = 'stretch', style, className, children
const [position, setPosition] = useState();
const ref = useRef();
const { offsetWidth } = anchor.current || {};
const resizer = useRef();
const { offsetWidth } = anchor.current || {};
useLayoutEffect(() => {
if (!ref.current || !anchor.current) {
return;
}
const [vertical, horizontal] = placement.split(' ');
if (typeof ResizeObserver === 'undefined') {
return;
}
const handlePosition = throttle(() => {
const anchorPosition = offset(anchor.current);
const elementPosition = offset(ref.current.parentElement);
setPosition({
...width === 'stretch' && anchor.current && {
width: offsetWidth,
......@@ -87,20 +86,23 @@ export const Position = ({ anchor, width = 'stretch', style, className, children
}, 30);
handlePosition();
const resizeObserver = new ResizeObserver(handlePosition);
const { current } = anchor;
if (typeof ResizeObserver !== 'undefined') {
resizer.current = new ResizeObserver(handlePosition);
resizer.current.observe(current);
}
window.addEventListener('scroll', handlePosition);
window.addEventListener('resize', handlePosition);
const { current } = anchor;
resizeObserver.observe(current);
return () => {
window.removeEventListener('scroll', handlePosition);
window.removeEventListener('resize', handlePosition);
resizeObserver.unobserve(current);
resizer.current && resizer.current.unobserve(current);
};
}, [anchor.current, anchor.current, placement, offsetWidth]);
}, [anchor.current, placement, offsetWidth]);
const portalContainer = useMemo(() => {
const element = document.createElement('div');
......
......@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.2.0-alpha.29](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.28...v0.2.0-alpha.29) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/icons
# [0.2.0-alpha.28](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.27...v0.2.0-alpha.28) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/icons
......
{
"name": "@rocket.chat/icons",
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"author": {
"name": "Rocket.Chat",
"url": "https://rocket.chat/"
......
......@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.2.0-alpha.29](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.28...v0.2.0-alpha.29) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/ui-kit
# [0.2.0-alpha.28](https://github.com/RocketChat/Rocket.Chat.Fuselage/compare/v0.2.0-alpha.27...v0.2.0-alpha.28) (2020-02-10)
**Note:** Version bump only for package @rocket.chat/ui-kit
......
{
"name": "@rocket.chat/ui-kit",
"version": "0.2.0-alpha.28",
"version": "0.2.0-alpha.29",
"description": "Package Fuselage ui kit ",
"author": "Guilherme Gazzo <guilhermegazzo@gmail.com>",
"homepage": "https://github.com/RocketChat/Rocket.Chat.Fuselage#readme",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment