carbon icon indicating copy to clipboard operation
carbon copied to clipboard

DateInput Custom Calendar Header via pickerProps isn't accessible

Open kairynners opened this issue 2 years ago • 3 comments

Current behaviour

When specifying a custom component for the DateInput calendar via pickerProps, and the captionElement key (to select a Year and Month etc.) the custom header that renders is inaccessible unless you manually set its styling position to "relative". Without manually intervening (setting the position), the component (and its children) don't react to any interaction because it is rendered behind the DateInput calendar itself). Trying to interact sets focus on the calendar as a whole (the ancestor).

Expected behaviour

The implementer/consumer shouldn't have to manually specify the components position relative to the calendar. Ideally this should happen automatically because it is a shared/common concern with the same solution each time. The controls to increment and decrement months should still function as before.

CodeSandbox or Storybook URL

https://codesandbox.io/s/ecstatic-benz-0hzids?file=/src/index.js

JIRA Ticket (Sage Only)

No response

Suggested Solution

Render the provided custom header component (specified in pickerProps via the captionElement key) within a static parent element, styled to have its position set to relative (position: relative). That way each consumer doesn't have to remember to do so.

Carbon Version

107.1.7

Design Tokens Version

2.30.0

What browsers are you seeing the problem on?

Chrome

What Operating System are you seeing the problem on?

Windows

Anything else we should know?

Link to Slack Chat: https://sageone.slack.com/archives/C0D6DD3N2/p1655807687663009

Confidentiality

  • [X] I confirm there is no confidential or commercially sensitive information included.

kairynners avatar Jun 21 '22 13:06 kairynners

@ljemmo I suppose the question here is does DS want developers to be able to override the controls provided in this way? Or should we provide options through Carbon?

nicktitchmarsh avatar Aug 02 '22 13:08 nicktitchmarsh

@nicktitchmarsh Looking at the code sandbox example, this is definitely a future enhancement that we would need to review and consider more deeply. I've seen other calendars with similar functionality and it's certainly an enhancement that i think we should explore.

Once reviewed and specs supplied, then I believe we should add carbon props to allow optional dropdowns for year and month (probably stylised in a more subtle way than in the sandbox). I don't think this should be an override.

@ingridzillinger please can you help me document this as a future enhancement on our backlog.

ljemmo avatar Aug 02 '22 16:08 ljemmo

@ljemmo @ingridzillinger , please could you comment the DSY ticket number here so we can track that work?

nicktitchmarsh avatar Aug 04 '22 12:08 nicktitchmarsh

Hi @ljemmo @ingridzillinger, do you have DSY ticket for this work in place? Or are there still some decisions you need to make?

Parsium avatar Oct 25 '22 13:10 Parsium

@nicktitchmarsh and @Parsium - The ticket is DSY-1739. I have a meeting with martin and ashley next week to discuss a proposed solution further.

ljemmo avatar Oct 26 '22 11:10 ljemmo

@ljemmo , what was the outcome of that ticket? Do we have some recommendations?

nicktitchmarsh avatar Nov 15 '22 14:11 nicktitchmarsh

@ljemmo @clairedenning is there any update on this

edleeks87 avatar Jan 24 '23 13:01 edleeks87

Raised ticket for next sprint DSY-2423

clairedenning avatar Feb 10 '23 09:02 clairedenning

Ticket DSY-2423 has been cancelled and done in DSY-2581 which has been completed. @clairedenning has a ticket been created on our board for this work or do we need to do that? Thanks.

sianford avatar Apr 04 '23 13:04 sianford

@ingridzillinger or @ljemmo can you answer Sian's question above?

clairedenning avatar Apr 05 '23 08:04 clairedenning

@sianford we are lumping together all our calendar improvement tasks into 2 pairing tickets:

DSY-2981 DSY-2267

ljemmo avatar Apr 05 '23 10:04 ljemmo

I'm going to close this as the DS have issued new designs that mean this will be baked into Carbon when we align. You can set the container for the calendar header to have position relative as a workaround. If this doesn't address the issue please re-open

edleeks87 avatar Dec 05 '23 11:12 edleeks87