-
Notifications
You must be signed in to change notification settings - Fork 53
Conversation
The positioning part of the /cc @levithomason |
73e67c1
to
82cd7c2
Compare
Codecov Report
@@ Coverage Diff @@
## master #150 +/- ##
==========================================
+ Coverage 90.17% 91.09% +0.92%
==========================================
Files 55 59 +4
Lines 916 1011 +95
Branches 142 159 +17
==========================================
+ Hits 826 921 +95
Misses 86 86
Partials 4 4
Continue to review full report at Codecov.
|
@layershifter @levithomason this is definitely something we want to try; do we want to address it in this PR or should we iterate? |
82cd7c2
to
95771c5
Compare
Popper looks extremely promising. It looks like the React wrapper is also gaining a lot of adoption: Let's definitely do our due diligence here and compare what we'd gain and lose by switching. I would love nothing more than to off load the problem components, such as Popup, to a shared community work load. Edit Just saw your latest comment @Bugaa92, yes, let's try Popper now before merging. |
From the accessibility point of view, as a User, I would like to add Popup behavior which will have defined actions to open/close popup with specified keys actionsDefinition: {
trigger: {
open: {
keyCombinations: [{ keyCode: keyboardKey.Enter }, { keyCode: keyboardKey.Spacebar }, { keyCode: keyboardKey.ArrowDown }],
},
},
portal: {
close: {
keyCombinations: [{ keyCode: keyboardKey.Escape }],
},
}
} And since as open/close logic is enclosed into the portal component, can we rethink its API to give a possibility to trigger open/close function from a popup? What your thoughts about it? @Bugaa92 @levithomason @jurokapsiar |
Also we should think about screener tests for this. With current examples, there is no screener coverage for the examples, because these are the screenshots we compare: So we either need to add examples with popup initially displayed (which will not work for some variants like fullscreen) or better introduce Test integrations for Screener tests. |
95771c5
to
37d92cc
Compare
@levithomason what do you guys think about @miroslavstastny 's suggestions regarding visual tests? see his comment below, he has a very good point! currently we don't seem to have the infrastructure to do this kind of scenario tests (that involve actions) and I'm afraid having the popups open by default are going to offer a bad UX |
ee3da57
to
ed34c98
Compare
597ff68
to
00f6ef0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/src/examples/components/Popup/Variations/PopupExampleBasic.shorthand.tsx
Outdated
Show resolved
Hide resolved
src/components/Portal/Portal.tsx
Outdated
|
||
type ReactMouseEvent = React.MouseEvent<HTMLElement> | ||
|
||
export interface IPortalProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface does not match propTypes
- as
, children
, styles
, variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, fixed
src/components/Popup/Popup.tsx
Outdated
after = 'after', | ||
} | ||
|
||
type Position = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's just me, but I am still confused with the naming here. Let's discuss what the two parts of the position name mean in both RTL and LTR and agree on the naming in broader group.
I guess the main source of confusion is start
/end
meaning something different in combination with top
/bottom
vs before
/after
. I can see the inspiration in flexbox'es main/cross axis, but still...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, I'll add this to your meeting notes to discuss it with everybody
docs/src/examples/components/Popup/Variations/PopupExamplePosition.shorthand.tsx
Outdated
Show resolved
Hide resolved
src/components/Ref/Ref.tsx
Outdated
} | ||
|
||
componentDidMount() { | ||
_.invoke(this.props, 'innerRef', findDOMNode(this)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a condition in SUIR code, let's use it there, too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure it's necessary since _.invoke
invokes innerRef
function only if it's defined; isn't it the same as SUIR?
fcd7b07
to
a5dc328
Compare
|
a5dc328
to
01710c7
Compare
docs/src/examples/components/Popup/Variations/PopupExampleBasic.shorthand.tsx
Outdated
Show resolved
Hide resolved
src/components/Popup/Popup.tsx
Outdated
const computedStyle = rtl ? rtlCSSJS(style) : style | ||
|
||
return ( | ||
<Popup.Content innerRef={ref} basic={basic} styles={{ root: computedStyle }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RTL is broken in docsite as dir="rtl"
is not set on body
which is a parent of Popup.Content
.
Do we want to add something like {...rtl && {dir:"rtl"}}
here? @jurokapsiar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, very good catch; I missed it because of using simple text as content (with no punctuation)
f25dd64
to
2ec0fae
Compare
ce91227
to
935d4ec
Compare
const alignedVertically = a === 'top' || a === 'bottom' | ||
|
||
return ( | ||
(isPositionedVertically && alignedVertically) || (!isPositionedVertically && !alignedVertically) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
isPositionedVertically === alignedVertically
Popup
This PR introduces the Popup, a component that displays additional information on top of a page at the end of the
body
DOM element. It comes with the following props:basic?: boolean
: whentrue
, it introduces basic CSS styling for the popup (defaultfalse
)align?: 'top' | 'bottom' | 'start' | 'end' | 'center'
position?: 'above' | 'below' | 'before' | 'after'
: the position of the popuptrigger: JSX.Element
: theReact
component that controls the popup; for now, clicking it toggles the visibility of the popupTODO
API Proposal
Default
A default popup requires the
trigger
prop and renders a popup at the end of thebody
DOM elementgenerates
and at the end of
body
DOM element:Basic
A basic popup renders a popup with very basic CSS.
generates
and at the end of
body
DOM element:Alignment and Position
A popup can be rendered in 12 different combinations of
align
andposition
props around the trigger element:position="above" align="start"
:position="above" align="center"
:position="above" align="end"
:position="below" align="start"
:position="below" align="center"
:position="below" align="end"
:position="before" align="top"
:position="before" align="center"
:position="before" align="bottom"
:position="after" align="top"
:position="after" align="center"
:position="after" align="bottom"
:generates
and at the end of
body
DOM element: