Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove disable editor #343

Merged
merged 1 commit into from Apr 9, 2024
Merged

Remove disable editor #343

merged 1 commit into from Apr 9, 2024

Conversation

aldabil21
Copy link
Owner

@aldabil21 aldabil21 commented Apr 9, 2024

  1. Remove disableEditor and make editable affect cells as well as events
  2. Make event item disabled if disableViewer is true

adjustment for #342

@aldabil21 aldabil21 merged commit ba945c3 into master Apr 9, 2024
2 checks passed
@aldabil21 aldabil21 deleted the disable-editor-issue branch April 9, 2024 10:48
@@ -140,7 +140,8 @@ const EventItem = ({ event, multiday, hasPrev, hasNext, showdate = true }: Event
onEventClick(event);
}
}}
disabled={event.disabled}
focusRipple
disabled={disableViewer || event.disabled}
Copy link
Contributor

@slash-84 slash-84 Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change could lead to a regression to a fix addressed here: #338

The purpose of that PR was giving the user the ability to listen for event click without using the viewer (e.g. custom navigation)

Copy link
Owner Author

@aldabil21 aldabil21 Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it
can you propose a fix that an event should not be focusable if its not clickable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion also with disableViewer=true events should be clickable (and focusable). With this property someone can use the calendar and intercept event click to attach custom logics, without opening the popover provided by this library.

Copy link
Contributor

@slash-84 slash-84 Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pay attention also on this line:

The disabling logic should remain aligned between this two components.

@@ -71,7 +71,6 @@ All props are _optional_
| viewerExtraComponent | Function(fields, event) OR Component. Additional component in event viewer popper |
| viewerTitleComponent | Function(event). Helper function to render custom title in event popper |
| disableViewer | boolean. If true, the viewer popover will be disabled globally |
| disableEditor | boolean. If true, the editor modal will be disabled globally |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that the use of editable could prevent the opening of the editor, at the same time my intention was to provide a way to click a grid cell, intercept the event and attach a custom logic.

Unfortunately with editable=false the recently introduced onCellClick is not called any more.

At the moment the only way I have to intercept the click is to implement a custom editor and close it programmatically (something similar of this hack on viewer side: #329 (comment)) and having the screen flashing for the backdrop appearing and disappearing immediatly.

Copy link
Owner Author

@aldabil21 aldabil21 Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to me that making it focusable without any click result (the popover) is unusual, it should not be the case.

I think you can resolve this using tabIndex of -1 if its disabled

can you open a PR for that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before doing any new PR I'd like to explain my needs so we can find the more appropriate way to implement ;)

In some scenarios I need to use the calendar disabling completely the default modal / popover. If a user click an event I only need a callback with event details. If a user click a cell on the grid I only need the cell details (start, end, resource...). I need also that in this case the grid works as usual (click, focus, and so on).

disableViewer was a good way to do it but no events were raised, because of the button disabled so in PR #338 I addressed a fix but now in this PR the fix was reverted.

I think buttons should not be disabled when disableViewer=true because we are asking the component to disable the popover, not events.

The same IMHO should be done for the editor: I need a way to disable completely the popover and give the possibility to the developer to implement its own logic.

I'll give you an example of why I am asking this: I need to fill some dates in a component of my application and such dates come from the interaction with events or the grid.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to make things generic and not for specific needs

IMO disabled button should not be focusable

To go around this and fulfill your needs, we can apply tabIndex={-1} without disable. In this case, the button will not be disabled, and also not focusable.

Does this sounds good for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try and do some experiments before merging so we can discuss on it. Can you open the PR (I'm not sure it's 100% clear for me)?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check #344

Copy link
Contributor

@slash-84 slash-84 Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, regression on clicks has disappeared.

I have another issue: with editable={false} I also lose the ability to drag & drop, is there a way to restore it?

BTW for the moment we can merge

Copy link
Contributor

@slash-84 slash-84 Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have another issue: with editable={false} I also lose the ability to drag & drop, is there a way to restore it?

have a look #346

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, regression on clicks has disappeared.

I have another issue: with editable={false} I also lose the ability to drag & drop, is there a way to restore it?

BTW for the moment we can merge

This is intended. drag & drop is an edit action. if editable is false, then it should not be dragged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants