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

Feature: Add Expanding Query Input Field #1020

Merged

Conversation

ayubun
Copy link
Contributor

@ayubun ayubun commented Jul 13, 2021

This PR is intended to allow the query input field to wrap / expand when necessary to create more visibility when using long queries. Fixes #613

Feature Preview:

3140de7358e3a3c43e828f25489f4579.mp4

Notably, this PR is a bit hacky, as I didn't know a few things. If I could receive input on the following, it would help the PR significantly, I think:

  • I couldn't figure out how to set a starting height for a multiline autoAdjustHeight FluentUI TextField; As far as I could tell, ​autoAdjustHeight​ forces the minimum height to 60px and I don't know where to modify that. It could very well be impossible.
  • This influenced my design of switching from a normal TextField to an autoAdjustHeight TextField when the text began to overflow, in order to keep the one-line aesthetic of the query input field. However, this switching functionality causes the TextField to snap from one line to 60px (autoAdjustHeight multiline default) when converting between the two.
  • The detection for overflow is most definitely buggy. It works, but it is off by a little bit depending on which letters you use to fill the field. I imagine it is because of a font issue/bug; I am curious if there is a better way to detect overflow in FluentUI?

AD#38277

@ayubun ayubun force-pushed the interns/AyuAi/query-word-wrap branch from fab527b to c4ade2c Compare July 13, 2021 23:56
@ayubun ayubun changed the title Expanding Query Input Field Feature: Add Expanding Query Input Field Aug 3, 2021
package.json Outdated Show resolved Hide resolved
Comment on lines 63 to 82
public isOverflowing = (input: string) => {

function getTextWidth(text: string) {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');

if (context === null) {
return 0;
}

context.font = getComputedStyle(document.body).font;
return context.measureText(text).width + 5;

}

return !!this.element
&& getTextWidth(input) > this.element.scrollWidth;

}

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is super COOL!

@thewahome thewahome self-requested a review August 3, 2021 14:30
@thewahome thewahome merged commit 667a68d into microsoftgraph:dev Aug 3, 2021
thewahome added a commit that referenced this pull request Aug 3, 2021
* Task: Add chat-id & membership-id (#1024)

* Fix: query link parsing with trailing '.' (#1033)

* Feature: DetailsList scrollbars only appear onHover (#1023)

* Feature: automatic dark light mode (#1019)

* Task: add translated aria labels (#1040)

* Task: remove sandbox api test (#1042)

* Fix: change hover scroll behaviour (#1043)

* Fix: Accessibility bugs - Aug  (#1041)

* Feature: Add Expanding Query Input Field (#1020)
@lhao03 lhao03 deleted the interns/AyuAi/query-word-wrap branch August 11, 2021 20:53
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.

Multi-line Query Editor
2 participants